From fb1689c1de5fdc945c599aa46b483fa5e1333935 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Wed, 18 Aug 2021 11:15:55 +0200
Subject: [PATCH] libfdisk: dereference of possibly-NULL [gcc-analyzer]

Signed-off-by: Karel Zak <kzak@redhat.com>
---
 libfdisk/src/parttype.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libfdisk/src/parttype.c b/libfdisk/src/parttype.c
index 3a5db9c..271b671 100644
--- a/libfdisk/src/parttype.c
+++ b/libfdisk/src/parttype.c
@@ -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"));
-- 
1.8.3.1

