From: Leefancy Date: Wed, 27 May 2026 07:45:41 +0000 (+0800) Subject: fdisk-list: fix memory leak when partition returns empty string X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=05ea3b7d99a2c01545bedd9fea9c96cdd0d6c6d9;p=thirdparty%2Futil-linux.git fdisk-list: fix memory leak when partition returns empty string Signed-off-by: Leefancy --- diff --git a/disk-utils/fdisk.c b/disk-utils/fdisk.c index d46a468e8..0f4340acb 100644 --- a/disk-utils/fdisk.c +++ b/disk-utils/fdisk.c @@ -940,8 +940,11 @@ int print_partition_info(struct fdisk_context *cxt) rc = fdisk_partition_to_string(pa, cxt, id, &data); if (rc < 0) goto clean_data; - if (!data || !*data) + if (!data || !*data) { + free(data); continue; + + } fdisk_info(cxt, "%15s: %s", fdisk_field_get_name(fd), data); free(data); }