Skip to content

Commit 5dd19d9

Browse files
authored
Merge pull request #58 from n-isaka/fix/cancel_all_clear
Clear the program stack when executing CANCEL ALL.
2 parents 2d6e62f + d93d607 commit 5dd19d9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

libcob/call.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,11 +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);
301-
strcpy (new_list->name, name);
300+
new_list->name = strdup (name);
302301
current_call_stack_list = new_list;
303302
return new_list;
304303
}
@@ -319,6 +318,8 @@ cob_cancel_call_stack_list (struct call_stack_list *p)
319318
if (p->sister) {
320319
cob_cancel_call_stack_list (p->sister);
321320
}
321+
free (p->name);
322+
free (p);
322323
}
323324

324325
const char *
@@ -784,5 +785,6 @@ cob_cancel_all ()
784785
return;
785786
}
786787
cob_cancel_call_stack_list (current_call_stack_list->children);
788+
current_call_stack_list->children = NULL;
787789
return;
788790
}

0 commit comments

Comments
 (0)