From 96113217ca1796f998db2554ab115ccbde07a1d2 Mon Sep 17 00:00:00 2001 From: andreas_kupries Date: Tue, 4 May 2004 03:50:59 +0000 Subject: * Applied [SF Tcl Patch 868853], fixing a mem leak in TtySetOptionProc. Report and Patch provided by Stuart Cassoff . --- ChangeLog | 6 ++++++ unix/tclUnixChan.c | 11 ++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 13d21b4..d2a4792 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-05-03 Andreas Kupries + + * Applied [SF Tcl Patch 868853], fixing a mem leak in + TtySetOptionProc. Report and Patch provided by Stuart + Cassoff . + 2004-05-03 Kevin Kenny * win/tclWin32Dll.c (TclpCheckStackSpace): diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index 794e8dd..b7f0339 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.2 2004/02/25 14:54:52 dkf Exp $ + * RCS: @(#) $Id: tclUnixChan.c,v 1.42.2.3 2004/05/04 03:50:59 andreas_kupries Exp $ */ #include "tclInt.h" /* Internal definitions for Tcl. */ @@ -969,9 +969,11 @@ TtySetOptionProc(instanceData, interp, optionName, value) "bad value for -xchar: should be a list of two elements", (char *) NULL); } + ckfree((char *) argv); return TCL_ERROR; } SETIOSTATE(fsPtr->fd, &iostate); + ckfree((char *) argv); return TCL_OK; } @@ -1004,12 +1006,14 @@ TtySetOptionProc(instanceData, interp, optionName, value) "bad value for -ttycontrol: should be a list of", "signal,value pairs", (char *) NULL); } + ckfree((char *) argv); return TCL_ERROR; } GETCONTROL(fsPtr->fd, &control); while (argc > 1) { if (Tcl_GetBoolean(interp, argv[1], &flag) == TCL_ERROR) { + ckfree((char *) argv); return TCL_ERROR; } if (strncasecmp(argv[0], "DTR", strlen(argv[0])) == 0) { @@ -1021,6 +1025,7 @@ TtySetOptionProc(instanceData, interp, optionName, value) } #else /* !TIOCM_DTR */ UNSUPPORTED_OPTION("-ttycontrol DTR"); + ckfree((char *) argv); return TCL_ERROR; #endif /* TIOCM_DTR */ } else if (strncasecmp(argv[0], "RTS", strlen(argv[0])) == 0) { @@ -1032,6 +1037,7 @@ TtySetOptionProc(instanceData, interp, optionName, value) } #else /* !TIOCM_RTS*/ UNSUPPORTED_OPTION("-ttycontrol RTS"); + ckfree((char *) argv); return TCL_ERROR; #endif /* TIOCM_RTS*/ } else if (strncasecmp(argv[0], "BREAK", strlen(argv[0])) == 0) { @@ -1039,6 +1045,7 @@ TtySetOptionProc(instanceData, interp, optionName, value) SETBREAK(fsPtr->fd, flag); #else /* !SETBREAK */ UNSUPPORTED_OPTION("-ttycontrol BREAK"); + ckfree((char *) argv); return TCL_ERROR; #endif /* SETBREAK */ } else { @@ -1047,12 +1054,14 @@ TtySetOptionProc(instanceData, interp, optionName, value) "bad signal for -ttycontrol: must be ", "DTR, RTS or BREAK", (char *) NULL); } + ckfree((char *) argv); return TCL_ERROR; } argc -= 2, argv += 2; } /* while (argc > 1) */ SETCONTROL(fsPtr->fd, &control); + ckfree((char *) argv); return TCL_OK; } -- cgit v0.12