Skip to contentSkip to conversation

stable-2.02 - cov: release iterator on error path

PATCH Zdenek Kabelac 1 participant 1 message Jun 25, 2019

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=09aafb61e31c3781530795057c87afaeb53a2bd4
Commit:        09aafb61e31c3781530795057c87afaeb53a2bd4
Parent:        3b42cdad0c27d79766c7e9aae50d13cd93a2ffbf
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Tue Jun 25 15:37:01 2019 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Tue Jun 25 17:32:44 2019 +0200

cov: release iterator on error path

---
 lib/label/label.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
lib/label/label.c +4 -1
index 4f8e135..9a3f8df 100644
@@ -866,8 +866,11 @@ int label_scan(struct cmd_context *cmd)
 	}
 
 	while ((dev = dev_iter_get(iter))) {
-		if (!(devl = dm_zalloc(sizeof(*devl))))
+		if (!(devl = dm_zalloc(sizeof(*devl)))) {
+			log_error("Failed to allocated device list.");
+			dev_iter_destroy(iter);
 			return 0;
+		}
 		devl->dev = dev;
 		dm_list_add(&all_devs, &devl->list);