From d90ed9c0f07bbb5cf66140e89fcebc0da3f08285 Mon Sep 17 00:00:00 2001 From: Kevin B Kenny Date: Sat, 6 Aug 2011 20:49:35 +0000 Subject: * generic/tclAssemnbly.c: Plug another memory leak. [Bug 3384840] * generic/tclStrToD.c: Plug another memory leak. [Bug 3386975] --- ChangeLog | 1 + generic/tclAssembly.c | 29 +++++++++++++++++++++++++++++ generic/tclStrToD.c | 3 +++ 3 files changed, 33 insertions(+) diff --git a/ChangeLog b/ChangeLog index 30568c7..293490a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2011-08-06 Kevin B, Kenny * generic/tclAssemnbly.c: Plug another memory leak. [Bug 3384840] + * generic/tclStrToD.c: Plug another memory leak. [Bug 3386975] 2011-08-05 Kevin B. Kenny diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index 22bcdcc..cd6dc38 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -859,15 +859,44 @@ CompileAssembleObj( /* * Assembly failed. Clean up and report the error. */ + + /* + * Free any literals that were constructed for the assembly. + */ for (i = 0; i < compEnv.literalArrayNext; i++) { TclReleaseLiteral(interp, compEnv.literalArrayPtr[i].objPtr); } + + /* + * Free any auxiliary data that was attached to the bytecode + * under construction. + */ + for (i = 0; i < compEnv.auxDataArrayNext; i++) { auxDataPtr = compEnv.auxDataArrayPtr + i; if (auxDataPtr->type->freeProc != NULL) { (auxDataPtr->type->freeProc)(auxDataPtr->clientData); } } + + /* + * TIP 280. If there is extended command line information, + * we need to clean it up. + */ + + if (compEnv.extCmdMapPtr != NULL) { + if (compEnv.extCmdMapPtr->type == TCL_LOCATION_SOURCE) { + Tcl_DecrRefCount(compEnv.extCmdMapPtr->path); + } + for (i = 0; i < compEnv.extCmdMapPtr->nuloc; ++i) { + ckfree(compEnv.extCmdMapPtr->loc[i].line); + } + if (compEnv.extCmdMapPtr->loc != NULL) { + ckfree(compEnv.extCmdMapPtr->loc); + } + Tcl_DeleteHashTable(&(compEnv.extCmdMapPtr->litInfo)); + } + TclFreeCompileEnv(&compEnv); return NULL; } diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index c2d4ed8..a55ee83 100755 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -4479,6 +4479,9 @@ TclFinalizeDoubleConversion(void) for (i=0; i<9; ++i) { mp_clear(pow5 + i); } + for (i=0; i < 5; ++i) { + mp_clear(pow5_13 + i); + } } /* -- cgit v0.12