From a8a958cc04da2c23e2a7a168ae19f05d4fcab1ae Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 27 Sep 2021 11:42:45 +0200 Subject: [PATCH] cleanup: reuse existing code for free path --- lib/format_text/format-text.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c index b2bbf3c66..e8b1865f8 100644 --- a/lib/format_text/format-text.c +++ b/lib/format_text/format-text.c @@ -964,12 +964,8 @@ static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg, r = 1; out: - if (!r) { - free(fidtc->write_buf); - fidtc->write_buf = NULL; - fidtc->write_buf_size = 0; - fidtc->new_metadata_size = 0; - } + if (!r) + free_text_fidtc(vg); return r; } @@ -1154,12 +1150,8 @@ static int _vg_commit_raw_rlocn(struct format_instance *fid, r = 1; out: - if (!precommit && !fidtc->preserve) { - free(fidtc->write_buf); - fidtc->write_buf = NULL; - fidtc->write_buf_size = 0; - fidtc->new_metadata_size = 0; - } + if (!precommit && !fidtc->preserve) + free_text_fidtc(vg); return r; }