summaryrefslogtreecommitdiff
path: root/libdm
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2021-09-18 21:00:49 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2021-09-20 13:58:57 +0200
commit951263865603dd9b431c8625c8feefe216cf0c74 (patch)
tree94829be4e91eae6526b5c7f1a33bf0efe9513ede /libdm
parent3e21c8524e8b31e61fe4db99664319e2823f1a53 (diff)
downloadlvm2-951263865603dd9b431c8625c8feefe216cf0c74.tar.gz
gcc-fanalyzer: better losetup error path
Fix leaking memory on error path on _process_losetup_switches(). However real impact is close to zero as dm-loop target isn't really used.
Diffstat (limited to 'libdm')
-rw-r--r--libdm/dm-tools/dmsetup.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libdm/dm-tools/dmsetup.c b/libdm/dm-tools/dmsetup.c
index a3d1248bc..f431f7509 100644
--- a/libdm/dm-tools/dmsetup.c
+++ b/libdm/dm-tools/dmsetup.c
@@ -6762,6 +6762,8 @@ static int _process_losetup_switches(const char *base, int *argcp, char ***argvp
if (!_table ||
!_loop_table(_table, (size_t) LOOP_TABLE_SIZE, loop_file, device_name, offset)) {
log_error("Could not build device-mapper table for %s.", (*argvp)[0]);
+ free(loop_file);
+ free(_table);
free(device_name);
return 0;
}
@@ -6770,6 +6772,7 @@ static int _process_losetup_switches(const char *base, int *argcp, char ***argvp
_command = "create";
(*argvp)[0] = device_name ;
*argcp = 1;
+ free(loop_file);
return 1;
}