File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -676,7 +676,9 @@ TpoolCancelObjCmd(
676676 tpoolPtr -> workTail = rPtr -> prevPtr ;
677677 }
678678 SetResult (NULL , rPtr ); /* Just to free the result */
679- Tcl_Free (rPtr -> script );
679+ if (rPtr -> script ) {
680+ Tcl_Free (rPtr -> script );
681+ }
680682 Tcl_Free (rPtr );
681683 Tcl_ListObjAppendElement (interp , doneList , wObjv [ii ]);
682684 break ;
@@ -1241,6 +1243,7 @@ TpoolWorker(
12411243 Tcl_MutexUnlock (& tpoolPtr -> mutex );
12421244 TpoolEval (interp , rPtr -> script , rPtr -> scriptLen , rPtr );
12431245 Tcl_Free (rPtr -> script );
1246+ rPtr -> script = NULL ;
12441247 Tcl_MutexLock (& tpoolPtr -> mutex );
12451248 if (!rPtr -> detached ) {
12461249 int isNew ;
@@ -1716,8 +1719,11 @@ TpoolRelease(
17161719 * Cleanup jobs posted but never completed.
17171720 */
17181721
1719- for (rPtr = tpoolPtr -> workHead ; rPtr ; rPtr = rPtr -> nextPtr ) {
1720- Tcl_Free (rPtr -> script );
1722+ for (rPtr = tpoolPtr -> workHead ; rPtr ; rPtr = tpoolPtr -> workHead ) {
1723+ tpoolPtr -> workHead = rPtr -> nextPtr ;
1724+ if (rPtr -> script ) {
1725+ Tcl_Free (rPtr -> script );
1726+ }
17211727 Tcl_Free (rPtr );
17221728 }
17231729 Tcl_MutexFinalize (& tpoolPtr -> mutex );
You can’t perform that action at this time.
0 commit comments