summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnand Avati <avati@gluster.com>2010-02-22 02:52:31 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-02-22 00:39:57 -0800
commite1a1dc21efb20bd7d7a85d0e3c19153615f458fc (patch)
treeca05d1e81b00f0c25c2bc5ff6e4abd60a84de55b
parenteaaa2bb56b6a629e723f9e9b97b0c1d722158eac (diff)
protocol/client: add memory allocation checks
Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 431 (segfault in timer thread :O) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=431
-rw-r--r--xlators/protocol/client/src/client-protocol.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/xlators/protocol/client/src/client-protocol.c b/xlators/protocol/client/src/client-protocol.c
index 91eb6df6434..8182954ceb6 100644
--- a/xlators/protocol/client/src/client-protocol.c
+++ b/xlators/protocol/client/src/client-protocol.c
@@ -488,13 +488,28 @@ client_start_ping (void *data)
hdrlen = gf_hdr_len (req, 0);
hdr = gf_hdr_new (req, 0);
+ if (!hdr)
+ goto err;
dummy_frame = create_frame (this, this->ctx->pool);
+
+ if (!dummy_frame)
+ goto err;
+
dummy_frame->local = trans;
ret = protocol_client_xfer (dummy_frame, this, trans,
GF_OP_TYPE_MOP_REQUEST, GF_MOP_PING,
hdr, hdrlen, NULL, 0, NULL);
+ return;
+err:
+ if (hdr)
+ FREE (hdr);
+
+ if (dummy_frame)
+ STACK_DESTROY (dummy_frame->root);
+
+ return;
}