From: Alasdair Kergon Date: Tue, 30 Sep 2008 20:37:52 +0000 (+0000) Subject: Free text metadata buffer after a failure writing it. X-Git-Tag: v2_02_91~3427 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=7eb1c3ed92ceabdee0e598f793e4e8f899f7bc22;p=lvm2.git Free text metadata buffer after a failure writing it. --- diff --git a/WHATS_NEW b/WHATS_NEW index 3b46bc9ff..32e537061 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.41 - ===================================== + Free text metadata buffer after a failure writing it. Fix misleading error message when there is no allocatable extents in VG. Fix handling of PVs which reappeared with old metadata version. Fix mirror DSO to call vgreduce with proper parameters. diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c index 209fb626c..3e5bc4499 100644 --- a/lib/format_text/format-text.c +++ b/lib/format_text/format-text.c @@ -597,8 +597,15 @@ static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg, r = 1; out: - if (!r && !dev_close(mdac->area.dev)) - stack; + if (!r) { + if (!dev_close(mdac->area.dev)) + stack; + + if (fidtc->raw_metadata_buf) { + dm_free(fidtc->raw_metadata_buf); + fidtc->raw_metadata_buf = NULL; + } + } return r; }