mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-28 16:15:57 -05:00
[worker] Make sure worker accepts NULL-arguments
This commit is contained in:
parent
7f7207bb87
commit
061beaf272
19
src/worker.c
19
src/worker.c
@ -149,15 +149,20 @@ worker_execute(void (*cb)(void *), void *cb_arg, size_t arg_size, int delay)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
argcpy = malloc(arg_size);
|
if (arg_size > 0)
|
||||||
if (!argcpy)
|
|
||||||
{
|
{
|
||||||
DPRINTF(E_LOG, L_MAIN, "Out of memory\n");
|
argcpy = malloc(arg_size);
|
||||||
free(cmdarg);
|
if (!argcpy)
|
||||||
return;
|
{
|
||||||
}
|
DPRINTF(E_LOG, L_MAIN, "Out of memory\n");
|
||||||
|
free(cmdarg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
memcpy(argcpy, cb_arg, arg_size);
|
memcpy(argcpy, cb_arg, arg_size);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
argcpy = NULL;
|
||||||
|
|
||||||
cmdarg->cb = cb;
|
cmdarg->cb = cb;
|
||||||
cmdarg->cb_arg = argcpy;
|
cmdarg->cb_arg = argcpy;
|
||||||
|
Loading…
Reference in New Issue
Block a user