Update stack argument initialization behaviour to terminate creation of process on failing memory allocations

This commit is contained in:
Themis Demetriades
2024-11-06 12:28:58 +00:00
parent b4c41b0a6a
commit b0c1923d44

View File

@@ -106,7 +106,15 @@ start_process (void *file_name_)
push_to_stack (&if_.esp, arg, (strlen (arg) + 1) * sizeof (char)); push_to_stack (&if_.esp, arg, (strlen (arg) + 1) * sizeof (char));
struct arg_elem *arg_elem = malloc (sizeof (struct arg_elem)); struct arg_elem *arg_elem = malloc (sizeof (struct arg_elem));
ASSERT (arg_elem != NULL); if (arg_elem == NULL)
{
printf("ERROR: Couldn't allocate argument pointer memory for %s!\n",
file_name);
palloc_free_page (file_name_);
if (success) process_exit ();
thread_exit ();
}
arg_elem->arg = arg; arg_elem->arg = arg;
list_push_front (&arg_list, &arg_elem->elem); list_push_front (&arg_list, &arg_elem->elem);