cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Lon Hohberger <lhh@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 4/5] rgmanager: Fix tiny memory leak in sl_service_status (RHEL5)
Date: Thu,  5 Jan 2012 10:57:34 -0500	[thread overview]
Message-ID: <1325779055-1424-4-git-send-email-lhh@redhat.com> (raw)
In-Reply-To: <1325779055-1424-1-git-send-email-lhh@redhat.com>

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



  parent reply	other threads:[~2012-01-05 15:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-05 15:57 [Cluster-devel] [PATCH 1/5] rgmanager: Add extra service status call (RHEL5) Lon Hohberger
2012-01-05 15:57 ` [Cluster-devel] [PATCH 2/5] rgmanager: Avoid duplicate restart of service (RHEL5) Lon Hohberger
2012-01-05 15:57 ` [Cluster-devel] [PATCH 3/5] rgmanager: Fix call to service_status() (RHEL5) Lon Hohberger
2012-01-05 15:57 ` Lon Hohberger [this message]
2012-01-05 15:57 ` [Cluster-devel] [PATCH 5/5] rgmanager: Fix dependency issue related to ordering (RHEL5) Lon Hohberger
2012-01-05 16:34   ` Lon Hohberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1325779055-1424-4-git-send-email-lhh@redhat.com \
    --to=lhh@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).