summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/client/src/client-protocol.c
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:54 -0800
commit40a07c180a479472b7fac8f16b7d825ca26f6f50 (patch)
tree4ce1ac181c50943beffc6f63edd7f3cdd05d4652 /xlators/protocol/client/src/client-protocol.c
parent94d31fdaf967f0d224a2bfa7b275b0344e0f5700 (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
Diffstat (limited to 'xlators/protocol/client/src/client-protocol.c')
-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;
}