diff options
author | Alasdair G Kergon <agk@redhat.com> | 2018-01-10 18:48:01 +0000 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2018-01-10 18:48:01 +0000 |
commit | c350f96c09f3fb591de1742829006769f53c29eb (patch) | |
tree | 214c0904de1e64edc191c5b4e2230ee0d9cea4be /lib/format_text | |
parent | 366493a1d1900757f4a203d3b89185afb878ad30 (diff) | |
download | lvm2-c350f96c09f3fb591de1742829006769f53c29eb.tar.gz |
device: Eliminate unnecessary buffer from dev_read.
Diffstat (limited to 'lib/format_text')
-rw-r--r-- | lib/format_text/format-text.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c index 26a500767..d28449ce1 100644 --- a/lib/format_text/format-text.c +++ b/lib/format_text/format-text.c @@ -272,20 +272,20 @@ static int _pv_analyze_mda_raw (const struct format_type * fmt, size += SECTOR_SIZE; } } - dm_free(buf); + if (circular) + dm_free(buf); buf = NULL; } r = 1; out: - dm_free(buf); + if (circular) + dm_free(buf); if (!dev_close(area->dev)) stack; return r; } - - static int _text_lv_setup(struct format_instance *fid __attribute__((unused)), struct logical_volume *lv) { @@ -512,12 +512,8 @@ static struct raw_locn *_find_vg_rlocn(struct device_area *dev_area, goto_bad; if (!strncmp(buf, vgname, len = strlen(vgname)) && - (isspace(*(buf + len)) || *(buf + len) == '{')) { - dm_free(buf); + (isspace(*(buf + len)) || *(buf + len) == '{')) return rlocn; - } - - dm_free(buf); log_debug_metadata("Volume group name found in %smetadata on %s at " FMTu64 " does " "not match expected name %s.", |