[commands] Coverity fixups

This commit is contained in:
ejurgensen 2022-01-20 00:12:01 +01:00
parent e321c54655
commit b059d73211

View File

@ -88,9 +88,9 @@ command_cb_sync(struct commands_base *cmdbase, struct command *cmd)
// Command execution is waiting for pending events before returning to the caller // Command execution is waiting for pending events before returning to the caller
cmdbase->current_cmd = cmd; cmdbase->current_cmd = cmd;
cmd->pending = cmd->ret; cmd->pending = cmd->ret;
return;
} }
else
{
// Command execution finished, execute the bottom half function // Command execution finished, execute the bottom half function
if (cmd->ret == 0 && cmd->func_bh) if (cmd->ret == 0 && cmd->func_bh)
cmd->func_bh(cmd->arg, &cmd->ret); cmd->func_bh(cmd->arg, &cmd->ret);
@ -104,7 +104,6 @@ command_cb_sync(struct commands_base *cmdbase, struct command *cmd)
// Note if cmd->func was cmdloop_exit then cmdbase may be invalid now, // Note if cmd->func was cmdloop_exit then cmdbase may be invalid now,
// because commands_base_destroy() may have freed it // because commands_base_destroy() may have freed it
} }
}
/* /*
* Event callback function * Event callback function
@ -357,7 +356,7 @@ commands_exec_async(struct commands_base *cmdbase, command_function func, void *
struct command *cmd; struct command *cmd;
int ret; int ret;
cmd = calloc(1, sizeof(struct command)); CHECK_NULL(L_MAIN, cmd = calloc(1, sizeof(struct command)));
cmd->func = func; cmd->func = func;
cmd->func_bh = NULL; cmd->func_bh = NULL;
cmd->arg = arg; cmd->arg = arg;