summaryrefslogtreecommitdiffstats
path: root/generic/tclAssembly.c
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2011-08-06 19:56:41 (GMT)
committerKevin B Kenny <kennykb@acm.org>2011-08-06 19:56:41 (GMT)
commit45f4a7ec08a29687ec671b5ff71549f7dc1d659f (patch)
treeb39d404dd00226ca79bd685cd914cad17ab6ab12 /generic/tclAssembly.c
parentc29c6011291530fa0d9f267921fbc93c5e3e0cb6 (diff)
downloadtcl-45f4a7ec08a29687ec671b5ff71549f7dc1d659f.zip
tcl-45f4a7ec08a29687ec671b5ff71549f7dc1d659f.tar.gz
tcl-45f4a7ec08a29687ec671b5ff71549f7dc1d659f.tar.bz2
Plug another memory leak. [Bug 3384840]
Diffstat (limited to 'generic/tclAssembly.c')
-rw-r--r--generic/tclAssembly.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c
index 3c23358..22bcdcc 100644
--- a/generic/tclAssembly.c
+++ b/generic/tclAssembly.c
@@ -783,11 +783,6 @@ TclNRAssembleObjCmd(
* Use NRE to evaluate the bytecode from the trampoline.
*/
-#if 0
- Tcl_NRAddCallback(interp, NRCallTEBC, INT2PTR(TCL_NR_BC_TYPE), codePtr,
- NULL, NULL);
- return TCL_OK;
-#endif
return TclNRExecuteByteCode(interp, codePtr);
}
@@ -817,11 +812,17 @@ CompileAssembleObj(
CompileEnv compEnv; /* Compilation environment structure */
register ByteCode *codePtr = NULL;
/* Bytecode resulting from the assembly */
+ register const AuxData * auxDataPtr;
+ /* Pointer to an auxiliary data element
+ * in a compilation environment being
+ * destroyed. */
Namespace* namespacePtr; /* Namespace in which variable and command
* names in the bytecode resolve */
int status; /* Status return from Tcl_AssembleCode */
const char* source; /* String representation of the source code */
int sourceLen; /* Length of the source code in bytes */
+ int i;
+
/*
* Get the expression ByteCode from the object. If it exists, make sure it
@@ -858,7 +859,15 @@ CompileAssembleObj(
/*
* Assembly failed. Clean up and report the error.
*/
-
+ for (i = 0; i < compEnv.literalArrayNext; i++) {
+ TclReleaseLiteral(interp, compEnv.literalArrayPtr[i].objPtr);
+ }
+ for (i = 0; i < compEnv.auxDataArrayNext; i++) {
+ auxDataPtr = compEnv.auxDataArrayPtr + i;
+ if (auxDataPtr->type->freeProc != NULL) {
+ (auxDataPtr->type->freeProc)(auxDataPtr->clientData);
+ }
+ }
TclFreeCompileEnv(&compEnv);
return NULL;
}