lvm: Fix segfault if a VG contains no LVs
authorBenjamin Gilbert <bgilbert@cs.cmu.edu>
Wed, 16 Apr 2014 20:27:07 +0000 (16:27 -0400)
committerBenjamin Gilbert <bgilbert@cs.cmu.edu>
Wed, 16 Apr 2014 20:27:07 +0000 (16:27 -0400)
src/lvm.c

index 97d8017..cbf244b 100644 (file)
--- a/src/lvm.c
+++ b/src/lvm.c
@@ -119,6 +119,8 @@ static void vg_read(vg_t vg, char const *vg_name)
     lvm_submit (vg_name, "free", lvm_vg_get_free_size(vg));
 
     lvs = lvm_vg_list_lvs(vg);
+    if (lvs == NULL)
+        return;
     dm_list_iterate_items(lvl, lvs) {
         name = lvm_lv_get_name(lvl->lv);
         attrs = lvm_lv_get_attr(lvl->lv);