1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

Check if info struct returned is not NULL.

Just some missing checks revealed by Coverity in recent code.
This commit is contained in:
Peter Rajnoha 2012-04-10 12:26:27 +00:00
parent 2d6f57be7e
commit fb4f76a29c
2 changed files with 6 additions and 2 deletions

5
lib/cache/lvmetad.c vendored
View File

@ -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);

View File

@ -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;