summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2004-02-25 14:50:40 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2004-02-25 14:50:40 (GMT)
commitac30665488b084dc91b7b4510921184a00e7ac51 (patch)
tree8bc940cd6a3ccad13526413d5406fc4a3f89d253
parent9314539d269d7799c7b0d8476102bebe351c7a4b (diff)
downloadtcl-ac30665488b084dc91b7b4510921184a00e7ac51.zip
tcl-ac30665488b084dc91b7b4510921184a00e7ac51.tar.gz
tcl-ac30665488b084dc91b7b4510921184a00e7ac51.tar.bz2
Fix memleak with long hostnames. [Bug 888777]
-rw-r--r--ChangeLog5
-rw-r--r--unix/tclUnixChan.c4
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 28e54fe..30b5811 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-02-25 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * unix/tclUnixChan.c (TcpGetOptionProc): Stop memory leak with
+ very long hostnames. [Bug 888777]
+
2004-02-25 Pat Thoyts <patthoyts@users.sourceforge.net>
* win/tclWinDde.c: Removed some gcc warnings - except for the
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c
index 3542ca8..70a9712 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.45 2003/12/24 04:18:22 davygrvy Exp $
+ * RCS: @(#) $Id: tclUnixChan.c,v 1.46 2004/02/25 14:50:41 dkf Exp $
*/
#include "tclInt.h" /* Internal definitions for Tcl. */
@@ -2292,6 +2292,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));
}
@@ -2338,6 +2339,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));
}