]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: handle allocation failure in fdisk_new_partition
authorThomas Weißschuh <thomas@t-8ch.de>
Fri, 22 Sep 2023 17:35:01 +0000 (19:35 +0200)
committerThomas Weißschuh <thomas@t-8ch.de>
Fri, 22 Sep 2023 18:30:12 +0000 (20:30 +0200)
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
libfdisk/src/partition.c

index 6b0d98a74f7e6c922e5eeea27bf773e8296379f2..bf3afadb13e1d76994ac32cb46a82dc1eca02a1f 100644 (file)
@@ -40,6 +40,8 @@ static void init_partition(struct fdisk_partition *pa)
 struct fdisk_partition *fdisk_new_partition(void)
 {
        struct fdisk_partition *pa = calloc(1, sizeof(*pa));
+       if (!pa)
+               return NULL;
 
        pa->refcount = 1;
        init_partition(pa);