diff options
author | pooryorick <com.digitalsmarties@pooryorick.com> | 2021-05-15 21:56:03 (GMT) |
---|---|---|
committer | pooryorick <com.digitalsmarties@pooryorick.com> | 2021-05-15 21:56:03 (GMT) |
commit | 7ee82af4aa11b02822159875e976d1469492e937 (patch) | |
tree | 7951504226debb7d782a9321015f34fa3b682fbd /unix | |
parent | 1134511a980250dfb27153be57b4e64e8455cdfe (diff) | |
download | tcl-7ee82af4aa11b02822159875e976d1469492e937.zip tcl-7ee82af4aa11b02822159875e976d1469492e937.tar.gz tcl-7ee82af4aa11b02822159875e976d1469492e937.tar.bz2 |
Fix [28027d8bb7745fb0], memory leaks in tclUnload.c,
Diffstat (limited to 'unix')
-rw-r--r-- | unix/dltest/pkgua.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/unix/dltest/pkgua.c b/unix/dltest/pkgua.c index 0ab3e23..7082b36 100644 --- a/unix/dltest/pkgua.c +++ b/unix/dltest/pkgua.c @@ -21,6 +21,7 @@ static int PkguaEqObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int PkguaQuoteObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +static void CommandDeleted(ClientData clientData); /* * In the following hash table we are going to store a struct that holds all @@ -40,6 +41,13 @@ static int interpTokenMapInitialised = 0; static void +CommandDeleted(ClientData clientData) +{ + Tcl_Command *cmdToken = clientData; + *cmdToken = NULL; +} + +static void PkguaInitTokensHashTable(void) { if (interpTokenMapInitialised) { @@ -221,12 +229,14 @@ Pkgua_Init( Tcl_SetVar2(interp, "::pkgua_loaded", NULL, ".", TCL_APPEND_VALUE); cmdTokens = PkguaInterpToTokens(interp); - cmdTokens[cmdIndex++] = - Tcl_CreateObjCommand(interp, "pkgua_eq", PkguaEqObjCmd, NULL, - NULL); - cmdTokens[cmdIndex++] = + cmdTokens[cmdIndex] = + Tcl_CreateObjCommand(interp, "pkgua_eq", PkguaEqObjCmd, &cmdTokens[cmdIndex], + CommandDeleted); + cmdIndex++; + cmdTokens[cmdIndex] = Tcl_CreateObjCommand(interp, "pkgua_quote", PkguaQuoteObjCmd, - NULL, NULL); + &cmdTokens[cmdIndex], CommandDeleted); + cmdIndex++; return TCL_OK; } |