summaryrefslogtreecommitdiffstats
path: root/transport
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2010-02-25 15:38:11 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-03-02 08:22:12 -0800
commit04614b28c81808a6c4f15cd6d3eb57aa8c976fe4 (patch)
treee85a2b1a3d6293ae4393ad49a501df98e0c01130 /transport
parente9ac64fe060fa497ade7921a398abb0b7f61f417 (diff)
socket: Add NULL check for failed ioq entry allocation
This is seen in OOM situations. Signed-off-by: Shehjar Tikoo <shehjart@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 679 (Crash in socket_ioq_new) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=679
Diffstat (limited to 'transport')
-rw-r--r--transport/socket/src/socket.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/transport/socket/src/socket.c b/transport/socket/src/socket.c
index 151ce3c..e269150 100644
--- a/transport/socket/src/socket.c
+++ b/transport/socket/src/socket.c
@@ -299,6 +299,8 @@ __socket_ioq_new (transport_t *this, char *buf, int len,
/* TODO: use mem-pool */
entry = CALLOC (1, sizeof (*entry));
+ if (!entry)
+ return NULL;
assert (count <= (MAX_IOVEC-2));
@@ -1329,6 +1331,8 @@ socket_submit (transport_t *this, char *buf, int len,
priv->submit_log = 0;
entry = __socket_ioq_new (this, buf, len, vector, count, iobref);
+ if (!entry)
+ goto unlock;
if (list_empty (&priv->ioq)) {
ret = __socket_ioq_churn_entry (this, entry);