[PATCH] Correctly free state string in wd

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

 



Signed-off-by: Jan Friesse <jfriesse@xxxxxxxxxx>
---
 exec/wd.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/exec/wd.c b/exec/wd.c
index 241304c..befa4d0 100644
--- a/exec/wd.c
+++ b/exec/wd.c
@@ -183,7 +183,7 @@ static const char * wd_res_event_to_str(struct cs_fsm* fsm,
  */
 static int32_t wd_resource_state_is_ok (struct resource *ref)
 {
-	char* state;
+	char* state = NULL;
 	uint64_t last_updated;
 	uint64_t my_time;
 	uint64_t allowed_period;
@@ -200,6 +200,9 @@ static int32_t wd_resource_state_is_ok (struct resource *ref)
 	if (icmap_get_string(key_name, &state) != CS_OK || strcmp(state, "disabled") == 0) {
 		/* key does not exist.
 		*/
+		if (state != NULL)
+			free(state);
+
 		return CS_FALSE;
 	}
 
-- 
1.7.1

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss


[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux