From e1a1dc21efb20bd7d7a85d0e3c19153615f458fc Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Mon, 22 Feb 2010 02:52:31 +0000 Subject: protocol/client: add memory allocation checks Signed-off-by: Anand V. Avati Signed-off-by: Anand V. Avati BUG: 431 (segfault in timer thread :O) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=431 --- xlators/protocol/client/src/client-protocol.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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; } -- cgit