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

dmstats: free bounds string in _stats_create_file() (Coverity)

This commit is contained in:
Bryn M. Reeves 2016-07-18 18:17:42 +01:00
parent 4ef1f34549
commit da146ae9b9

View File

@ -5012,8 +5012,15 @@ static int _stats_create_file(CMD_ARGS)
} }
} }
if (histogram && !(bounds = dm_histogram_bounds_from_string(histogram))) if (!(abspath = _get_abspath(path))) {
log_error("Could not canonicalize file name: %s", path);
return 0;
}
if (histogram && !(bounds = dm_histogram_bounds_from_string(histogram))) {
dm_free(abspath);
return_0; return_0;
}
if (_switches[PROGRAM_ID_ARG]) if (_switches[PROGRAM_ID_ARG])
program_id = _string_args[PROGRAM_ID_ARG]; program_id = _string_args[PROGRAM_ID_ARG];
@ -5023,11 +5030,6 @@ static int _stats_create_file(CMD_ARGS)
precise = _int_args[PRECISE_ARG]; precise = _int_args[PRECISE_ARG];
group = !_switches[NOGROUP_ARG]; group = !_switches[NOGROUP_ARG];
if (!(abspath = _get_abspath(path))) {
log_error("Could not canonicalize file name: %s", path);
return 0;
}
if (!(dms = dm_stats_create(DM_STATS_PROGRAM_ID))) if (!(dms = dm_stats_create(DM_STATS_PROGRAM_ID)))
return_0; return_0;
@ -5089,8 +5091,7 @@ static int _stats_create_file(CMD_ARGS)
return 1; return 1;
bad: bad:
if (abspath) dm_free(abspath);
dm_free(abspath);
if ((fd > -1) && close(fd)) if ((fd > -1) && close(fd))
log_error("Error closing %s", path); log_error("Error closing %s", path);