1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-09-14 09:44:18 +03:00

Compare commits

..

1 Commits

Author SHA1 Message Date
Bryn M. Reeves
0610f72c2a dmsetup: ensure --filemap histogram bounds are freed
Make sure that the temporary dm_histogram used for the bounds
argument is freed in the case that the user provided a --bounds
argument on the command line.
2016-09-14 15:52:37 +01:00
2 changed files with 17 additions and 12 deletions

View File

@@ -176,13 +176,13 @@ fi
%attr(644, -, -) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/lvm.conf
%attr(644, -, -) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/lvmlocal.conf
%dir %{_sysconfdir}/lvm/profile
%{_sysconfdir}/lvm/profile/command_profile_template.profile
%{_sysconfdir}/lvm/profile/metadata_profile_template.profile
%{_sysconfdir}/lvm/profile/thin-generic.profile
%{_sysconfdir}/lvm/profile/thin-performance.profile
%{_sysconfdir}/lvm/profile/cache-mq.profile
%{_sysconfdir}/lvm/profile/cache-smq.profile
%{_sysconfdir}/lvm/profile/lvmdbusd.profile
%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/profile/command_profile_template.profile
%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/profile/metadata_profile_template.profile
%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/profile/thin-generic.profile
%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/profile/thin-performance.profile
%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/profile/cache-mq.profile
%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/profile/cache-smq.profile
%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/profile/lvmdbusd.profile
%dir %{_sysconfdir}/lvm/backup
%dir %{_sysconfdir}/lvm/cache
%dir %{_sysconfdir}/lvm/archive

View File

@@ -4951,12 +4951,12 @@ static char *_get_abspath(const char *path)
static int _stats_create_file(CMD_ARGS)
{
const char *alias, *program_id = DM_STATS_PROGRAM_ID;
const char *histogram = _string_args[BOUNDS_ARG];
const char *bounds_str = _string_args[BOUNDS_ARG];
uint64_t *regions, *region, count = 0;
struct dm_histogram *bounds = NULL;
char *path, *abspath = NULL;
struct dm_stats *dms = NULL;
int group, fd, precise;
struct dm_stats *dms;
if (_switches[AREAS_ARG] || _switches[AREA_SIZE_ARG]) {
log_error("--filemap is incompatible with --areas and --area-size.");
@@ -5017,7 +5017,8 @@ static int _stats_create_file(CMD_ARGS)
return 0;
}
if (histogram && !(bounds = dm_histogram_bounds_from_string(histogram))) {
if (bounds_str
&& !(bounds = dm_histogram_bounds_from_string(bounds_str))) {
dm_free(abspath);
return_0;
}
@@ -5031,7 +5032,7 @@ static int _stats_create_file(CMD_ARGS)
group = !_switches[NOGROUP_ARG];
if (!(dms = dm_stats_create(DM_STATS_PROGRAM_ID)))
return_0;
goto_bad;
fd = open(abspath, O_RDONLY);
@@ -5087,16 +5088,20 @@ static int _stats_create_file(CMD_ARGS)
dm_free(regions);
dm_free(abspath);
dm_free(bounds);
dm_stats_destroy(dms);
return 1;
bad:
dm_free(abspath);
dm_free(bounds);
if ((fd > -1) && close(fd))
log_error("Error closing %s", path);
dm_stats_destroy(dms);
if (dms)
dm_stats_destroy(dms);
return 0;
}