[Cluster-devel] [PATCH 21/41] cman: fix free handle logic

Fabio M. Di Nitto fdinitto at redhat.com
Wed Nov 23 10:15:40 UTC 2011


Spotted by Coverity Scan

Signed-off-by: Fabio M. Di Nitto <fdinitto at redhat.com>
---
:100644 100644 284b351... 6b61332... M	cman/daemon/commands.c
 cman/daemon/commands.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/cman/daemon/commands.c b/cman/daemon/commands.c
index 284b351..6b61332 100644
--- a/cman/daemon/commands.c
+++ b/cman/daemon/commands.c
@@ -563,8 +563,6 @@ static int do_cmd_get_extrainfo(char *cmdbuf, char **retbuf, int retsize, int *r
 	corosync->object_find_create(OBJECT_PARENT_HANDLE, "totem", strlen("totem"), &totem_find_handle);
 	if (corosync->object_find_next(totem_find_handle, &totem_object_handle) == 0) {
 
-		corosync->object_find_destroy(totem_find_handle);
-
 		corosync->object_find_create(totem_object_handle, "interface", strlen("interface"), &iface_find_handle);
 		while (corosync->object_find_next(iface_find_handle, &object_handle) == 0) {
 
@@ -589,8 +587,10 @@ static int do_cmd_get_extrainfo(char *cmdbuf, char **retbuf, int retsize, int *r
 			}
 			ptr += sizeof(struct sockaddr_storage);
 		}
+
+		corosync->object_find_destroy(iface_find_handle);
 	}
-	corosync->object_find_destroy(iface_find_handle);
+	corosync->object_find_destroy(totem_find_handle);
 
 	for (i=0; i<num_interfaces; i++) {
 		ss = (struct sockaddr_storage *)ptr;
-- 
1.7.4.4




More information about the Cluster-devel mailing list