]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: dereference of possibly-NULL [gcc-analyzer]
authorKarel Zak <kzak@redhat.com>
Wed, 18 Aug 2021 09:15:55 +0000 (11:15 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 18 Aug 2021 09:15:55 +0000 (11:15 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk/src/parttype.c

index 3a5db9c2886f837729fd352c55e910b5f6f9b407..271b671464cfc42b9bc2bc124c24e827da67338b 100644 (file)
@@ -26,6 +26,9 @@ struct fdisk_parttype *fdisk_new_parttype(void)
 {
        struct fdisk_parttype *t = calloc(1, sizeof(*t));
 
+       if (!t)
+               return NULL;
+
        t->refcount = 1;
        t->flags = FDISK_PARTTYPE_ALLOCATED;
        DBG(PARTTYPE, ul_debugobj(t, "alloc"));