Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

jim.c: properly free cached callframes

Commit 87ea45c removed the code to free cached callframes
when the interpreter is freed. Restore that code.

Signed-off-by: Steve Bennett <steveb@workware.net.au>
  • Loading branch information...
commit cc40852e8730ec995d9bb12980e6242831fa1f49 1 parent cbd44b0
@msteveb authored
Showing with 13 additions and 6 deletions.
  1. +13 −6 jim.c
View
19 jim.c
@@ -5439,15 +5439,14 @@ Jim_Interp *Jim_CreateInterp(void)
void Jim_FreeInterp(Jim_Interp *i)
{
- Jim_CallFrame *cf = i->framePtr, *prevcf;
+ Jim_CallFrame *cf, *cfx;
+
Jim_Obj *objPtr, *nextObjPtr;
- /* Free the call frames list - must be done before i->commands is destroyed */
- while (cf) {
- prevcf = cf->parent;
+ /* Free the active call frames list - must be done before i->commands is destroyed */
+ for (cf = i->framePtr; cf; cf = cfx) {
+ cfx = cf->parent;
JimFreeCallFrame(i, cf, JIM_FCF_FULL);
- Jim_Free(cf);
- cf = prevcf;
}
Jim_DecrRefCount(i, i->emptyObj);
@@ -5507,6 +5506,14 @@ void Jim_FreeInterp(Jim_Interp *i)
objPtr = nextObjPtr;
}
+ /* Free the free call frames list */
+ for (cf = i->freeFramesList; cf; cf = cfx) {
+ cfx = cf->next;
+ if (cf->vars.table)
+ Jim_FreeHashTable(&cf->vars);
+ Jim_Free(cf);
+ }
+
/* Free the interpreter structure. */
Jim_Free(i);
}
Please sign in to comment.
Something went wrong with that request. Please try again.