From: Benjamin Gilbert Date: Wed, 16 Apr 2014 20:27:07 +0000 (-0400) Subject: lvm: Fix segfault if a VG contains no LVs X-Git-Tag: collectd-5.5.0~232^2~3 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=45805cf888cda0e840d774f1d42cd21525a722ea;p=collectd.git lvm: Fix segfault if a VG contains no LVs --- diff --git a/src/lvm.c b/src/lvm.c index 97d80170..cbf244b3 100644 --- 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);