diff options
author | David Teigland <teigland@redhat.com> | 2018-05-14 13:45:55 -0500 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2018-05-14 13:45:55 -0500 |
commit | 11ceb77867560e0b804df5ec3162e9cbdc9ed321 (patch) | |
tree | 8caa96382f50d30bf1303071225a47076c5001dc | |
parent | 517d6cc418da0ba08a971b6d537cdfada7a5b1cb (diff) | |
download | lvm2-11ceb77867560e0b804df5ec3162e9cbdc9ed321.tar.gz |
lvmcache: fix loop freeing infos
valgrind was concerned about loop through vginfo->infos,
so grab info from dev.
-rw-r--r-- | lib/cache/lvmcache.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c index 12c1c993f..991299561 100644 --- a/lib/cache/lvmcache.c +++ b/lib/cache/lvmcache.c @@ -1310,7 +1310,7 @@ int lvmcache_label_rescan_vg(struct cmd_context *cmd, const char *vgname, const struct dm_list devs; struct device_list *devl, *devl2; struct lvmcache_vginfo *vginfo; - struct lvmcache_info *info, *info2; + struct lvmcache_info *info; if (lvmetad_used()) return 1; @@ -1339,9 +1339,9 @@ int lvmcache_label_rescan_vg(struct cmd_context *cmd, const char *vgname, const dm_list_add(&devs, &devl->list); } - /* Deleting the last info will delete vginfo. */ - dm_list_iterate_items_safe(info, info2, &vginfo->infos) - lvmcache_del(info); + /* Delete info for each dev, deleting the last info will delete vginfo. */ + dm_list_iterate_items(devl, &devs) + lvmcache_del_dev(devl->dev); /* Dropping the last info struct is supposed to drop vginfo. */ if ((vginfo = lvmcache_vginfo_from_vgname(vgname, vgid))) |