Skip to content

Commit be47d1b

Browse files
committed
fix(call): call stack cleanup when cancel all.
* Fixed the program stack list to be initialized every time CANCEL ALL is executed.
1 parent 166fcf8 commit be47d1b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

libcob/call.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,10 @@ init_call_stack_list (void)
294294
static struct call_stack_list *
295295
cob_create_call_stack_list (char *name)
296296
{
297-
struct call_stack_list *new_list = cob_malloc (sizeof (struct call_stack_list));
297+
struct call_stack_list *new_list = malloc (sizeof (struct call_stack_list));
298298
memset (new_list, 0, sizeof (struct call_stack_list));
299299
new_list->parent = current_call_stack_list;
300-
new_list->name = cob_malloc (strlen (name) + 1);
300+
new_list->name = malloc (strlen (name) + 1);
301301
strcpy (new_list->name, name);
302302
current_call_stack_list = new_list;
303303
return new_list;
@@ -319,6 +319,8 @@ cob_cancel_call_stack_list (struct call_stack_list *p)
319319
if (p->sister) {
320320
cob_cancel_call_stack_list (p->sister);
321321
}
322+
free (p->name);
323+
free (p);
322324
}
323325

324326
const char *
@@ -784,5 +786,6 @@ cob_cancel_all ()
784786
return;
785787
}
786788
cob_cancel_call_stack_list (current_call_stack_list->children);
789+
current_call_stack_list->children = NULL;
787790
return;
788791
}

0 commit comments

Comments
 (0)