diff --git a/libcob/call.c b/libcob/call.c index 2ba402b..7497e7c 100644 --- a/libcob/call.c +++ b/libcob/call.c @@ -294,11 +294,10 @@ init_call_stack_list (void) static struct call_stack_list * cob_create_call_stack_list (char *name) { - struct call_stack_list *new_list = cob_malloc (sizeof (struct call_stack_list)); + struct call_stack_list *new_list = malloc (sizeof (struct call_stack_list)); memset (new_list, 0, sizeof (struct call_stack_list)); new_list->parent = current_call_stack_list; - new_list->name = cob_malloc (strlen (name) + 1); - strcpy (new_list->name, name); + new_list->name = strdup (name); current_call_stack_list = new_list; return new_list; } @@ -319,6 +318,8 @@ cob_cancel_call_stack_list (struct call_stack_list *p) if (p->sister) { cob_cancel_call_stack_list (p->sister); } + free (p->name); + free (p); } const char * @@ -784,5 +785,6 @@ cob_cancel_all () return; } cob_cancel_call_stack_list (current_call_stack_list->children); + current_call_stack_list->children = NULL; return; }