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

Fix allocation bug in text metadata format write error path.

Function _text_pv_write doesn't use memory pool but static buffer,
call dm_pool_free in error path in _raw_write_mda_header is wrong.

Move pool free only to path where is the memory pool used.
This commit is contained in:
Milan Broz 2008-08-16 09:46:55 +00:00
parent f88fd44680
commit a4a1cd76ba
2 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.40 - Version 2.02.40 -
================================ ================================
Fix allocation bug in text metadata format write error path.
Fix vgcfgbackup to properly check filename if template is used. Fix vgcfgbackup to properly check filename if template is used.
configure aborts if lcov or genhtml are missing with --enable-profiling configure aborts if lcov or genhtml are missing with --enable-profiling
vgremove tries to remove lv snapshot first. vgremove tries to remove lv snapshot first.

View File

@ -346,10 +346,8 @@ static int _raw_write_mda_header(const struct format_type *fmt,
MDA_HEADER_SIZE - MDA_HEADER_SIZE -
sizeof(mdah->checksum_xl))); sizeof(mdah->checksum_xl)));
if (!dev_write(dev, start_byte, MDA_HEADER_SIZE, mdah)) { if (!dev_write(dev, start_byte, MDA_HEADER_SIZE, mdah))
dm_pool_free(fmt->cmd->mem, mdah);
return_0; return_0;
}
return 1; 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, if (!_raw_write_mda_header(fid->fmt, mdac->area.dev, mdac->area.start,
mdah)) { mdah)) {
dm_pool_free(fid->fmt->cmd->mem, mdah);
log_error("Failed to write metadata area header"); log_error("Failed to write metadata area header");
goto out; 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, if (!_raw_write_mda_header(fid->fmt, mdac->area.dev, mdac->area.start,
mdah)) { mdah)) {
dm_pool_free(fid->fmt->cmd->mem, mdah);
log_error("Failed to write metadata area header"); log_error("Failed to write metadata area header");
goto out; goto out;
} }