summaryrefslogtreecommitdiffstats
path: root/generic/tclVar.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclVar.c')
-rw-r--r--generic/tclVar.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/generic/tclVar.c b/generic/tclVar.c
index 13d5dc6..17b859c 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -15,7 +15,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclVar.c,v 1.127 2007/02/20 23:24:03 nijtmans Exp $
+ * RCS: @(#) $Id: tclVar.c,v 1.128 2007/03/12 18:06:14 dgp Exp $
*/
#include "tclInt.h"
@@ -3023,8 +3023,7 @@ TclArraySet(
* NULL, create an empty array. */
{
Var *varPtr, *arrayPtr;
- Tcl_Obj **elemPtrs;
- int result, elemLen, i, nameLen;
+ int result, i, nameLen;
char *varName, *p;
varName = Tcl_GetStringFromObj(arrayNameObj, &nameLen);
@@ -3100,6 +3099,8 @@ TclArraySet(
* Not a dictionary, so assume (and convert to, for
* backward-compatability reasons) a list.
*/
+ int elemLen;
+ Tcl_Obj **elemPtrs, *copyListObj;
result = Tcl_ListObjGetElements(interp, arrayElemObj,
&elemLen, &elemPtrs);
@@ -3121,6 +3122,7 @@ TclArraySet(
* loop and return an error.
*/
+ copyListObj = TclListObjCopy(NULL, arrayElemObj);
for (i=0 ; i<elemLen ; i+=2) {
char *part2 = TclGetString(elemPtrs[i]);
Var *elemVarPtr = TclLookupArrayElement(interp, varName,
@@ -3133,6 +3135,7 @@ TclArraySet(
break;
}
}
+ Tcl_DecrRefCount(copyListObj);
return result;
}