1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

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.
This commit is contained in:
Zdenek Kabelac 2021-09-18 21:00:49 +02:00
parent 3e21c8524e
commit 9512638656

View File

@ -6762,6 +6762,8 @@ static int _process_losetup_switches(const char *base, int *argcp, char ***argvp
if (!_table || if (!_table ||
!_loop_table(_table, (size_t) LOOP_TABLE_SIZE, loop_file, device_name, offset)) { !_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]); log_error("Could not build device-mapper table for %s.", (*argvp)[0]);
free(loop_file);
free(_table);
free(device_name); free(device_name);
return 0; return 0;
} }
@ -6770,6 +6772,7 @@ static int _process_losetup_switches(const char *base, int *argcp, char ***argvp
_command = "create"; _command = "create";
(*argvp)[0] = device_name ; (*argvp)[0] = device_name ;
*argcp = 1; *argcp = 1;
free(loop_file);
return 1; return 1;
} }