[lvm-devel] master - clean: avoid cleaning iterator on error path

Zdenek Kabelac zkabelac at sourceware.org
Fri May 3 11:18:17 UTC 2019


Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3c70ae1803b06dea68b2e6e1ec2176b3f3fe9707
Commit:        3c70ae1803b06dea68b2e6e1ec2176b3f3fe9707
Parent:        99de816a1bb6414e4611030c8d83766b1ff3cd65
Author:        Zdenek Kabelac <zkabelac at redhat.com>
AuthorDate:    Fri May 3 12:01:20 2019 +0200
Committer:     Zdenek Kabelac <zkabelac at redhat.com>
CommitterDate: Fri May 3 13:17:22 2019 +0200

clean: avoid cleaning iterator on error path

Return error dirrectly instead of using 'out' code path.
---
 tools/toollib.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/toollib.c b/tools/toollib.c
index b352839..8e882e9 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -3933,14 +3933,14 @@ static int _get_all_devices(struct cmd_context *cmd,
 
 			if (!(dil = dm_pool_alloc(cmd->mem, sizeof(*dil)))) {
 				log_error("device_id_list alloc failed.");
-				goto out;
+				return ECMD_FAILED;
 			}
 
 			strncpy(dil->pvid, hint->pvid, ID_LEN);
 			dil->dev = dev;
 			dm_list_add(all_devices, &dil->list);
 		}
-		return 1;
+		return ECMD_PROCESSED;
 	}
 
 	log_debug("Getting list of all devices from system");




More information about the lvm-devel mailing list