summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2002-02-28 00:38:26 (GMT)
committerhobbs <hobbs>2002-02-28 00:38:26 (GMT)
commit49a515fc12d7e65f230fd2935f6756c0be1eb2be (patch)
tree8afea1df3fce7d893425126632dd27b8c1c3e715
parent51f1a7d2d89d74abce6789db5dd7832798e98e0e (diff)
downloadtcl-49a515fc12d7e65f230fd2935f6756c0be1eb2be.zip
tcl-49a515fc12d7e65f230fd2935f6756c0be1eb2be.tar.gz
tcl-49a515fc12d7e65f230fd2935f6756c0be1eb2be.tar.bz2
* generic/tclLink.c (Tcl_LinkVar): correct mem leak in error case.
-rw-r--r--generic/tclLink.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/generic/tclLink.c b/generic/tclLink.c
index 8d7a3fe..60a86f1 100644
--- a/generic/tclLink.c
+++ b/generic/tclLink.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclLink.c,v 1.5 2002/02/15 14:28:49 dkf Exp $
+ * RCS: @(#) $Id: tclLink.c,v 1.6 2002/02/28 00:38:26 hobbs Exp $
*/
#include "tclInt.h"
@@ -95,6 +95,7 @@ Tcl_LinkVar(interp, varName, addr, type)
* Also may have TCL_LINK_READ_ONLY
* OR'ed in. */
{
+ Tcl_Obj *objPtr;
Link *linkPtr;
int code;
@@ -109,9 +110,11 @@ Tcl_LinkVar(interp, varName, addr, type)
} else {
linkPtr->flags = 0;
}
- if (Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr),
+ objPtr = ObjValue(linkPtr);
+ if (Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, objPtr,
TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG) == NULL) {
Tcl_DecrRefCount(linkPtr->varName);
+ Tcl_DecrRefCount(objPtr);
ckfree((char *) linkPtr);
return TCL_ERROR;
}