diff options
author | dgp <dgp@users.sourceforge.net> | 2014-07-17 15:48:59 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2014-07-17 15:48:59 (GMT) |
commit | db085cadf4603de2c124a2b2afc4b020d28d21c7 (patch) | |
tree | 89786851a6f658ff3ed26de651fefb6f45f63ca2 | |
parent | f9efaaa3654408f97cb74fdac4b1309b067f7e71 (diff) | |
download | tcl-db085cadf4603de2c124a2b2afc4b020d28d21c7.zip tcl-db085cadf4603de2c124a2b2afc4b020d28d21c7.tar.gz tcl-db085cadf4603de2c124a2b2afc4b020d28d21c7.tar.bz2 |
Revised fix for memleak in [info frame]. Still pretty ugly, but not more
so than a lot of TIP 280 machinery.
-rw-r--r-- | generic/tclCmdIL.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index a26d6cc..d723e4b 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -1287,6 +1287,7 @@ TclInfoFrame( "eval", "eval", "eval", "precompiled", "source", "proc" }; Proc *procPtr = framePtr->framePtr ? framePtr->framePtr->procPtr : NULL; + int needsFree = -1; /* * Pull the information and construct the dictionary to return, as list. @@ -1360,6 +1361,9 @@ TclInfoFrame( } ADD_PAIR("cmd", TclGetSourceFromFrame(fPtr, 0, NULL)); + if (fPtr->cmdObj && framePtr->cmdObj == NULL) { + needsFree = lc - 1; + } TclStackFree(interp, fPtr); break; } @@ -1447,7 +1451,11 @@ TclInfoFrame( } } - return Tcl_NewListObj(lc, lv); + tmpObj = Tcl_NewListObj(lc, lv); + if (needsFree >= 0) { + Tcl_DecrRefCount(lv[needsFree]); + } + return tmpObj; } /* |