fix: correct allocate error handling

main
Sean McBride 4 years ago
parent 0307760810
commit 32099fa948

@ -52,17 +52,18 @@ local_runqueue_list_get_next()
if (global_request_scheduler_remove(&sandbox_request) < 0) goto err; if (global_request_scheduler_remove(&sandbox_request) < 0) goto err;
struct sandbox *sandbox = sandbox_allocate(sandbox_request); struct sandbox *sandbox = sandbox_allocate(sandbox_request);
if (!sandbox) goto err; if (!sandbox) goto err_allocate;
sandbox->state = SANDBOX_RUNNABLE; sandbox->state = SANDBOX_RUNNABLE;
local_runqueue_add(sandbox); local_runqueue_add(sandbox);
done: done:
return sandbox; return sandbox;
err: err_allocate:
client_socket_send(sandbox_request->socket_descriptor, 503); client_socket_send(sandbox_request->socket_descriptor, 503);
client_socket_close(sandbox_request->socket_descriptor); client_socket_close(sandbox_request->socket_descriptor);
free(sandbox_request); free(sandbox_request);
err:
sandbox = NULL; sandbox = NULL;
goto done; goto done;
} }

Loading…
Cancel
Save