libfdisk: check calloc() return [gcc-analyzer]
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
58b43e4b4f
commit
e826aa3f49
|
@ -36,6 +36,10 @@ int fdisk_set_ask(struct fdisk_context *cxt,
|
|||
struct fdisk_ask *fdisk_new_ask(void)
|
||||
{
|
||||
struct fdisk_ask *ask = calloc(1, sizeof(struct fdisk_ask));
|
||||
|
||||
if (!ask)
|
||||
return NULL;
|
||||
|
||||
DBG(ASK, ul_debugobj(ask, "alloc"));
|
||||
ask->refcount = 1;
|
||||
return ask;
|
||||
|
|
|
@ -40,6 +40,9 @@ struct fdisk_labelitem *fdisk_new_labelitem(void)
|
|||
{
|
||||
struct fdisk_labelitem *li = calloc(1, sizeof(*li));
|
||||
|
||||
if (!li)
|
||||
return NULL;
|
||||
|
||||
li->refcount = 1;
|
||||
DBG(ITEM, ul_debugobj(li, "alloc"));
|
||||
return li;
|
||||
|
|
Loading…
Reference in New Issue