summaryrefslogtreecommitdiff
path: root/libparted
diff options
context:
space:
mode:
authorBrian C. Lane <bcl@redhat.com>2022-03-25 11:17:33 -0700
committerBrian C. Lane <bcl@redhat.com>2022-03-25 11:17:33 -0700
commitb0cdc21a209f023c2adf091137fa380e62cfba0e (patch)
treeca6d8cbc88c4484fc1e7510ca5d45c9800579c30 /libparted
parenta303c9e68f4c47e8ccea04328ded4dd2ff07f9e6 (diff)
downloadparted-b0cdc21a209f023c2adf091137fa380e62cfba0e.tar.gz
libparted: Fix syntax-check sc_avoid_if_before_free error
It is safe to free even if they are NULL.
Diffstat (limited to 'libparted')
-rw-r--r--libparted/arch/linux.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 9b61e32..f3bf14d 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -1404,17 +1404,12 @@ init_sdmmc (PedDevice* dev)
if (sdmmc_get_product_info (dev, &type, &name)) {
snprintf (id, sizeof(id) - 1, "%s %s", type, name);
- free (type);
- free (name);
} else {
- // One or the other may have been allocated, free it
- if (type)
- free(type);
- if (name)
- free(name);
snprintf (id, sizeof(id) - 1, "%s",
_("Generic SD/MMC Storage Card"));
}
+ free (type);
+ free (name);
return init_generic(dev, id);
}