aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2024-04-02 09:00:22 +1000
committerSteve Bennett <steveb@workware.net.au>2024-04-02 09:02:37 +1000
commit9d8ccde662c66049b933f09e34b100628e02b769 (patch)
treec3b8bd9270d14dafc9fe9f654c12c068c5e7058b
parent4b980e667b2a07f5ea3aeb437079db9be6f89979 (diff)
downloadjimtcl-9d8ccde662c66049b933f09e34b100628e02b769.zip
jimtcl-9d8ccde662c66049b933f09e34b100628e02b769.tar.gz
jimtcl-9d8ccde662c66049b933f09e34b100628e02b769.tar.bz2
fix a memory leak on interp shutdown
Need to delete the commands hash table before calling Jim_InterpIncrProcEpoch() as otherwise the commands won't yet be in the "old command" list to be deleted. Signed-off-by: Steve Bennett <steveb@workware.net.au>
-rw-r--r--jim.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/jim.c b/jim.c
index ec855a2..fba53ac 100644
--- a/jim.c
+++ b/jim.c
@@ -5820,10 +5820,11 @@ 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);
- Jim_FreeHashTable(&i->commands);
#ifdef JIM_REFERENCES
Jim_FreeHashTable(&i->references);
#endif