Skip to content

Commit

Permalink
Ensure command deleters are called before freeing singletons
Browse files Browse the repository at this point in the history
This prevents situations where the delproc function (e.g. for aio)
access already deleted singleton objects.

Fixes #312

Signed-off-by: Steve Bennett <[email protected]>
  • Loading branch information
msteveb committed Oct 20, 2024
1 parent 1273201 commit a956545
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions jim.c
Original file line number Diff line number Diff line change
Expand Up @@ -5825,6 +5825,9 @@ void Jim_FreeInterp(Jim_Interp *i)
JimFreeCallFrame(i, cf, JIM_FCF_FULL);
}

/* Must be done before freeing singletons */
Jim_FreeHashTable(&i->commands);

Jim_DecrRefCount(i, i->emptyObj);
Jim_DecrRefCount(i, i->trueObj);
Jim_DecrRefCount(i, i->falseObj);
Expand All @@ -5836,8 +5839,6 @@ void Jim_FreeInterp(Jim_Interp *i)
Jim_DecrRefCount(i, i->nullScriptObj);
Jim_DecrRefCount(i, i->currentFilenameObj);

Jim_FreeHashTable(&i->commands);

/* This will disard any cached commands */
Jim_InterpIncrProcEpoch(i);

Expand Down

0 comments on commit a956545

Please sign in to comment.