From 3e86687e74bdf4847f3e35063dfb46e9871d6959 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Fri, 4 Dec 2009 21:27:15 +0000 Subject: fix crash in server protocol server-connection-destroy a variable allocated inside a condition was getting reffered outside the block. If the condition fails, there used to be a crash. Signed-off-by: Amar Tumballi Signed-off-by: Anand V. Avati BUG: 439 (crash in server protocol, while destroying connection) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=439 --- xlators/protocol/server/src/server-helpers.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'xlators/protocol') diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c index 112712e7f87..88dada1516e 100644 --- a/xlators/protocol/server/src/server-helpers.c +++ b/xlators/protocol/server/src/server-helpers.c @@ -831,13 +831,15 @@ server_connection_destroy (xlator_t *this, server_connection_t *conn) } } - state = CALL_STATE (frame); - if (state) - free (state); - STACK_DESTROY (frame->root); + if (frame) { + state = CALL_STATE (frame); + if (state) + free (state); + STACK_DESTROY (frame->root); + } - gf_log (this->name, GF_LOG_INFO, "destroyed connection of %s", - conn->id); + gf_log (this->name, GF_LOG_INFO, "destroyed connection of %s", + conn->id); FREE (conn->id); FREE (conn); -- cgit