summaryrefslogtreecommitdiffstats
path: root/generic/tclCmdIL.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-07-11 12:56:16 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-07-11 12:56:16 (GMT)
commit3088c8e046d26ebc9db26c8f3edffdf32cc327be (patch)
tree524873d7c1ccfe6a57b6d210112b130606a8202e /generic/tclCmdIL.c
parentabb3fd7af04401f4735829d4c491d35f1a24506f (diff)
downloadtcl-3088c8e046d26ebc9db26c8f3edffdf32cc327be.zip
tcl-3088c8e046d26ebc9db26c8f3edffdf32cc327be.tar.gz
tcl-3088c8e046d26ebc9db26c8f3edffdf32cc327be.tar.bz2
Stop memleak in [info frame].
Diffstat (limited to 'generic/tclCmdIL.c')
-rw-r--r--generic/tclCmdIL.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index db216e5..f870245 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -1288,6 +1288,9 @@ TclInfoFrame(
};
Proc *procPtr = framePtr->framePtr ? framePtr->framePtr->procPtr : NULL;
+ /* Super ugly hack added to the pile so we can plug memleak */
+ int needsFree = -1;
+
/*
* Pull the information and construct the dictionary to return, as list.
* Regarding use of the CmdFrame fields see tclInt.h, and its definition.
@@ -1360,6 +1363,7 @@ TclInfoFrame(
}
ADD_PAIR("cmd", TclGetSourceFromFrame(fPtr, 0, 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;
}
/*