scalloc can return NULL if it fails to allocate memory. Check for this
condition and fail the helper thread setup if it occurs.
This issue was reported by Coverity:
** CID 496644: Null pointer dereferences (NULL_RETURNS)
/helper_thread.c: 425 in helper_thread_create()
419
420 hd = scalloc(1, sizeof(*hd));
421
422 setup_disk_util();
423 steadystate_setup();
424
>>> CID 496644: Null pointer dereferences (NULL_RETURNS)
>>> Dereferencing "hd", which is known to be "NULL".
425 hd->sk_out = sk_out;
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
int ret;
hd = scalloc(1, sizeof(*hd));
+ if (!hd)
+ return 1;
setup_disk_util();
steadystate_setup();