fix a memory leak
authorLaurent Mazet <mazet@softndesign.org>
Tue, 14 Feb 2023 22:25:12 +0000 (23:25 +0100)
committerLaurent Mazet <mazet@softndesign.org>
Tue, 14 Feb 2023 22:25:12 +0000 (23:25 +0100)
workspace.c

index 26bbe8abcbcd70fb2f30d79a2e1f9d06249fbc85..9fc4d83d522795b0bfab4c1e4043527694dd1e5c 100644 (file)
@@ -23,8 +23,17 @@ workspace_t *alloc_ws ()
 workspace_t *backup_ws (workspace_t *ws)
 {
     ws->answer = answer;
+    if (ws->argument) {
+        free_tab (ws->argument);
+    }
     ws->argument = copy_tab (argument);
+    if (ws->stack) {
+        free_tab (ws->stack);
+    }
     ws->stack = copy_tab (stack);
+    if (ws->storage) {
+        free_tab (ws->storage);
+    }
     ws->storage = copy_tab (storage);
     return ws;
 }