diff --git a/WHATS_NEW b/WHATS_NEW index c6e1502d7..c58f60903 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.40 - ================================ + Fix allocation bug in text metadata format write error path. Fix vgcfgbackup to properly check filename if template is used. configure aborts if lcov or genhtml are missing with --enable-profiling vgremove tries to remove lv snapshot first. diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c index e499af0ba..429c1d2c3 100644 --- a/lib/format_text/format-text.c +++ b/lib/format_text/format-text.c @@ -346,10 +346,8 @@ static int _raw_write_mda_header(const struct format_type *fmt, MDA_HEADER_SIZE - sizeof(mdah->checksum_xl))); - if (!dev_write(dev, start_byte, MDA_HEADER_SIZE, mdah)) { - dm_pool_free(fmt->cmd->mem, mdah); + if (!dev_write(dev, start_byte, MDA_HEADER_SIZE, mdah)) return_0; - } return 1; } @@ -670,6 +668,7 @@ static int _vg_commit_raw_rlocn(struct format_instance *fid, if (!_raw_write_mda_header(fid->fmt, mdac->area.dev, mdac->area.start, mdah)) { + dm_pool_free(fid->fmt->cmd->mem, mdah); log_error("Failed to write metadata area header"); goto out; } @@ -752,6 +751,7 @@ static int _vg_remove_raw(struct format_instance *fid, struct volume_group *vg, if (!_raw_write_mda_header(fid->fmt, mdac->area.dev, mdac->area.start, mdah)) { + dm_pool_free(fid->fmt->cmd->mem, mdah); log_error("Failed to write metadata area header"); goto out; }