Fix NULL deref in cmd_ipc

This commit is contained in:
Jerzi Kaminsky 2017-04-21 02:17:55 +03:00
parent 403dccabce
commit 02dfa15d30

View file

@ -32,8 +32,12 @@ struct cmd_results *cmd_ipc(int argc, char **argv) {
return cmd_results_new(
CMD_FAILURE, "ipc", "Memory allocation error occured.");
}
current_policy = alloc_ipc_policy(program);
list_add(config->ipc_policies, current_policy);
if ((current_policy = alloc_ipc_policy(program))) {
list_add(config->ipc_policies, current_policy);
} else {
return cmd_results_new(
CMD_FAILURE, "ipc", "Failed to allocate security policy.");
}
free(program);
return cmd_results_new(CMD_BLOCK_IPC, NULL, NULL);