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

lvmcache: fix loop freeing infos

valgrind was concerned about loop through vginfo->infos,
so grab info from dev.
This commit is contained in:
David Teigland 2018-05-14 13:45:55 -05:00
parent 517d6cc418
commit 11ceb77867

View File

@ -1310,7 +1310,7 @@ int lvmcache_label_rescan_vg(struct cmd_context *cmd, const char *vgname, const
struct dm_list devs; struct dm_list devs;
struct device_list *devl, *devl2; struct device_list *devl, *devl2;
struct lvmcache_vginfo *vginfo; struct lvmcache_vginfo *vginfo;
struct lvmcache_info *info, *info2; struct lvmcache_info *info;
if (lvmetad_used()) if (lvmetad_used())
return 1; 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); dm_list_add(&devs, &devl->list);
} }
/* Deleting the last info will delete vginfo. */ /* Delete info for each dev, deleting the last info will delete vginfo. */
dm_list_iterate_items_safe(info, info2, &vginfo->infos) dm_list_iterate_items(devl, &devs)
lvmcache_del(info); lvmcache_del_dev(devl->dev);
/* Dropping the last info struct is supposed to drop vginfo. */ /* Dropping the last info struct is supposed to drop vginfo. */
if ((vginfo = lvmcache_vginfo_from_vgname(vgname, vgid))) if ((vginfo = lvmcache_vginfo_from_vgname(vgname, vgid)))