diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2007-06-30 14:07:50 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2007-06-30 14:07:50 (GMT) |
commit | ac3a9b43fdb9eab96727dbf392aa04f2b81ebd51 (patch) | |
tree | 494eef77ccca97796c7aac032d6d4a98736f7baf /generic/tclCmdIL.c | |
parent | 22f41058c511758b0e8085d4518b7c32a1d932c9 (diff) | |
download | tcl-ac3a9b43fdb9eab96727dbf392aa04f2b81ebd51.zip tcl-ac3a9b43fdb9eab96727dbf392aa04f2b81ebd51.tar.gz tcl-ac3a9b43fdb9eab96727dbf392aa04f2b81ebd51.tar.bz2 |
Plug a memory leak caused by a missing Tcl_DecrRefCount on an error path. [Bug 1717186]
Diffstat (limited to 'generic/tclCmdIL.c')
-rw-r--r-- | generic/tclCmdIL.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 702bdca..69f8a67 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -16,7 +16,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdIL.c,v 1.119 2007/06/22 20:42:23 dgp Exp $ + * RCS: @(#) $Id: tclCmdIL.c,v 1.120 2007/06/30 14:07:50 dkf Exp $ */ #include "tclInt.h" @@ -1188,7 +1188,8 @@ InfoFrameCmd( * Execution of bytecode. Talk to the BC engine to fill out the frame. */ - Proc *procPtr = framePtr->framePtr ? framePtr->framePtr->procPtr : NULL; + Proc *procPtr = + framePtr->framePtr ? framePtr->framePtr->procPtr : NULL; CmdFrame *fPtr; fPtr = (CmdFrame *) TclStackAlloc(interp, sizeof(CmdFrame)); @@ -1197,7 +1198,6 @@ InfoFrameCmd( /* * Note: * Type BC => f.data.eval.path is not used. - * f.data.tebc.codePtr is used instead. */ @@ -1221,7 +1221,8 @@ InfoFrameCmd( Tcl_DecrRefCount(fPtr->data.eval.path); } - ADD_PAIR("cmd", Tcl_NewStringObj(fPtr->cmd.str.cmd, fPtr->cmd.str.len)); + ADD_PAIR("cmd", + Tcl_NewStringObj(fPtr->cmd.str.cmd, fPtr->cmd.str.len)); if (procPtr != NULL) { Tcl_HashEntry *namePtr = procPtr->cmdPtr->hPtr; @@ -3991,7 +3992,7 @@ Tcl_LsortObjCmd( * 1675116] */ - listObj = TclListObjCopy(interp,listObj); + listObj = TclListObjCopy(interp, listObj); if (listObj == NULL) { if (sortInfo.indexc > 1) { ckfree((char *) sortInfo.indexv); @@ -4009,9 +4010,10 @@ Tcl_LsortObjCmd( Tcl_IncrRefCount(newCommandPtr); if (Tcl_ListObjAppendElement(interp, newCommandPtr, newObjPtr) != TCL_OK) { - Tcl_DecrRefCount(newCommandPtr); + TclDecrRefCount(newCommandPtr); + TclDecrRefCount(listObj) Tcl_IncrRefCount(newObjPtr); - Tcl_DecrRefCount(newObjPtr); + TclDecrRefCount(newObjPtr); if (sortInfo.indexc > 1) { ckfree((char *) sortInfo.indexv); } @@ -4070,8 +4072,8 @@ Tcl_LsortObjCmd( done: if (sortInfo.sortMode == SORTMODE_COMMAND) { - Tcl_DecrRefCount(sortInfo.compareCmdPtr); - Tcl_DecrRefCount(listObj); + TclDecrRefCount(sortInfo.compareCmdPtr); + TclDecrRefCount(listObj); sortInfo.compareCmdPtr = NULL; } if (sortInfo.indexc > 1) { |