diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c index 356b78f2c..f2bb8ebce 100644 --- a/lib/cache/lvmetad.c +++ b/lib/cache/lvmetad.c @@ -138,8 +138,9 @@ static struct lvmcache_info *_pv_populate_lvmcache( if (!vgname) vgname = fmt->orphan_vg_name; - info = lvmcache_add(fmt->labeller, (const char *)&pvid, device, - vgname, (const char *)&vgid, 0); + if (!(info = lvmcache_add(fmt->labeller, (const char *)&pvid, device, + vgname, (const char *)&vgid, 0))) + return_NULL; lvmcache_get_label(info)->sector = label_sector; lvmcache_set_device_size(info, devsize); diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c index ef28539a2..abd02c8e6 100644 --- a/lib/format_text/format-text.c +++ b/lib/format_text/format-text.c @@ -1455,6 +1455,9 @@ static int _text_pv_read(const struct format_type *fmt, const char *pv_name, info = label->info; } + if (!info) + return_0; + if (!lvmcache_populate_pv_fields(info, pv, scan_label_only)) return 0;