From 55a84d83113bfd6b1c28779a61f92ea760695a96 Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 25 Feb 2004 14:54:36 +0000 Subject: Fix memleak with long hostnames. [Bug 888777] --- ChangeLog | 5 +++++ unix/tclUnixChan.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5a9c7ed..c87f02f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-02-25 Donal K. Fellows + + * unix/tclUnixChan.c (TcpGetOptionProc): Stop memory leak with + very long hostnames. [Bug 888777] + 2004-02-25 David Gravereaux * tests/winPipe.test: diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index 7b6f59f..794e8dd 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixChan.c,v 1.42.2.1 2003/10/23 17:49:06 andreas_kupries Exp $ + * RCS: @(#) $Id: tclUnixChan.c,v 1.42.2.2 2004/02/25 14:54:52 dkf Exp $ */ #include "tclInt.h" /* Internal definitions for Tcl. */ @@ -2289,6 +2289,7 @@ TcpGetOptionProc(instanceData, interp, optionName, dsPtr) Tcl_ExternalToUtfDString(NULL, hostEntPtr->h_name, -1, &ds); Tcl_DStringAppendElement(dsPtr, Tcl_DStringValue(&ds)); + Tcl_DStringFree(&ds); } else { Tcl_DStringAppendElement(dsPtr, inet_ntoa(peername.sin_addr)); } @@ -2335,6 +2336,7 @@ TcpGetOptionProc(instanceData, interp, optionName, dsPtr) Tcl_ExternalToUtfDString(NULL, hostEntPtr->h_name, -1, &ds); Tcl_DStringAppendElement(dsPtr, Tcl_DStringValue(&ds)); + Tcl_DStringFree(&ds); } else { Tcl_DStringAppendElement(dsPtr, inet_ntoa(sockname.sin_addr)); } -- cgit v0.12