cluster: RHEL59 - fenced: fix double free when second method has no devices

David Teigland teigland at fedoraproject.org
Mon Jul 23 22:03:03 UTC 2012


Gitweb:        http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=77bb92ad9dbad9c8755e45211214ab1e099cdb0e
Commit:        77bb92ad9dbad9c8755e45211214ab1e099cdb0e
Parent:        6c9717cbbca38ee94911cbbc481c310f6375d560
Author:        David Teigland <teigland at redhat.com>
AuthorDate:    Mon Jul 23 17:01:57 2012 -0500
Committer:     David Teigland <teigland at redhat.com>
CommitterDate: Mon Jul 23 17:01:57 2012 -0500

fenced: fix double free when second method has no devices

When the second fence method is empty, the already
freed device is freed again, causing a segfault.

bz 809390

Signed-off-by: David Teigland <teigland at redhat.com>
---
 fence/fenced/agent.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fence/fenced/agent.c b/fence/fenced/agent.c
index 753b915..de4467c 100644
--- a/fence/fenced/agent.c
+++ b/fence/fenced/agent.c
@@ -361,8 +361,10 @@ int dispatch_fence_agent(char *victim, int force)
 			device = NULL;
 		}
 
-		if (device)
+		if (device) {
 			free(device);
+			device = NULL;
+		}
 		free(method);
 
 		if (!error) {


More information about the cluster-commits mailing list