cluster: RHEL58 - rgmanager: Fix tiny memory leak in sl_service_status
Lon Hohberger
lon at fedoraproject.org
Thu Jan 5 16:43:41 UTC 2012
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=07891324276c5414e6000b50bccafe9235bd4a4a
Commit: 07891324276c5414e6000b50bccafe9235bd4a4a
Parent: 9b5d039ecab105db426b112e865be59feb41a592
Author: Lon Hohberger <lhh at redhat.com>
AuthorDate: Thu Jan 5 10:12:05 2012 -0500
Committer: Lon Hohberger <lhh at redhat.com>
CommitterDate: Thu Jan 5 10:56:37 2012 -0500
rgmanager: Fix tiny memory leak in sl_service_status
Resolves: rhbz#743214
Signed-off-by: Lon Hohberger <lhh at 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);
}
More information about the cluster-commits
mailing list