summaryrefslogtreecommitdiffstats
path: root/generic/tclVar.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2016-09-06 20:30:07 (GMT)
committerdgp <dgp@users.sourceforge.net>2016-09-06 20:30:07 (GMT)
commita8ee2c14547d09ebb8f93ee3cea938302ea7a4c8 (patch)
tree98754cbedd26b0ba64676c965398c948535417e9 /generic/tclVar.c
parent05c0da6eee9a84deb417980eb524efd8395516ec (diff)
downloadtcl-a8ee2c14547d09ebb8f93ee3cea938302ea7a4c8.zip
tcl-a8ee2c14547d09ebb8f93ee3cea938302ea7a4c8.tar.gz
tcl-a8ee2c14547d09ebb8f93ee3cea938302ea7a4c8.tar.bz2
[4dbdd9af14] Proposed fix for mem leak.
Diffstat (limited to 'generic/tclVar.c')
-rw-r--r--generic/tclVar.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/generic/tclVar.c b/generic/tclVar.c
index bdc64b7..55eb91c 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -4498,7 +4498,6 @@ TclDeleteNamespaceVars(
Tcl_GetVariableFullName(interp, (Tcl_Var) varPtr, objPtr);
UnsetVarStruct(varPtr, NULL, iPtr, /* part1 */ objPtr,
NULL, flags);
- Tcl_DecrRefCount(objPtr); /* free no longer needed obj */
/*
* Remove the variable from the table and force it undefined in case
@@ -4527,6 +4526,12 @@ TclDeleteNamespaceVars(
}
}
}
+
+ if (!TclIsVarUndefined(varPtr)) {
+ UnsetVarStruct(varPtr, NULL, iPtr, /* part1 */ objPtr,
+ NULL, flags);
+ }
+ Tcl_DecrRefCount(objPtr); /* free no longer needed obj */
VarHashRefCount(varPtr)--;
VarHashDeleteEntry(varPtr);
}