[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [PATCH 4/5] rgmanager: Fix tiny memory leak in sl_service_status (RHEL5)



Resolves: rhbz#743214

Signed-off-by: Lon Hohberger <lhh redhat com>
---
 rgmanager/src/daemons/slang_event.c |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/rgmanager/src/daemons/slang_event.c b/rgmanager/src/daemons/slang_event.c
index c9cca7a..b033656 100644
--- a/rgmanager/src/daemons/slang_event.c
+++ b/rgmanager/src/daemons/slang_event.c
@@ -234,7 +234,8 @@ get_service_state_internal(char *svcName, rg_state_t *svcStatus)
 		service_status(servicename)
 
 For extra information (flags, transition time)
-   (transition_time, flags, rte, restarts, owner, state) = 
+   (transition_time, flags, rte, restarts, last_owner,
+    owner, state) =
                 service_status(servicename, 1);
  */
 static void
@@ -298,7 +299,7 @@ sl_service_status(void)
 			     "%s: Failed to get status for %s",
 			     __FUNCTION__,
 			     svcName);
-		return;
+		goto out_free;
 	}
 
 	if (extra) {
@@ -310,7 +311,7 @@ sl_service_status(void)
 				     (char *)"%s: Failed to push mtime %s",
 				     __FUNCTION__,
 				     svcName);
-			return;
+			goto out_free;
 		}
 
 		flags = (int)svcStatus.rs_flags;
@@ -319,7 +320,7 @@ sl_service_status(void)
 				     (char *)"%s: Failed to push flags %s",
 				     __FUNCTION__,
 				     svcName);
-			return;
+			goto out_free;
 		}
 	}
 
@@ -329,7 +330,7 @@ sl_service_status(void)
 			     "%s: Failed to push restarts_exceeded %s",
 			     __FUNCTION__,
 			     svcName);
-		return;
+		goto out_free;
 	}
 
 	if (SLang_push_integer(svcStatus.rs_restarts) < 0) {
@@ -337,7 +338,7 @@ sl_service_status(void)
 			     "%s: Failed to push restarts for %s",
 			     __FUNCTION__,
 			     svcName);
-		return;
+		goto out_free;
 	}
 
 	if (SLang_push_integer(svcStatus.rs_last_owner) < 0) {
@@ -345,7 +346,7 @@ sl_service_status(void)
 			     "%s: Failed to push last owner of %s",
 			     __FUNCTION__,
 			     svcName);
-		return;
+		goto out_free;
 	}
 
 	switch(svcStatus.rs_state) {
@@ -363,7 +364,7 @@ sl_service_status(void)
 			     "%s: Failed to push owner of %s",
 			     __FUNCTION__,
 			     svcName);
-		return;
+		goto out_free;
 	}
 
 	if (svcStatus.rs_flags & RG_FLAG_FROZEN) {
@@ -379,7 +380,7 @@ sl_service_status(void)
 			     "%s: Failed to duplicate state of %s",
 			     __FUNCTION__,
 			     svcName);
-		return;
+		goto out_free;
 	}
 
 	if (SLang_push_malloced_string(state_str) < 0) {
@@ -389,6 +390,10 @@ sl_service_status(void)
 			     svcName);
 		free(state_str);
 	}
+
+out_free:
+	if (svcName)
+		free(svcName);
 }
 
 
-- 
1.7.3.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]