summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2010-02-02 08:46:35 +0100
committerMartin Sustrik <sustrik@250bpm.com>2010-02-02 08:46:35 +0100
commit5d16070ffcd426e81ea27520f6847d68e5e5af80 (patch)
treeb3a160c5f5673c8bcf6484e286f35725abef32b6
parenta1e70f29575994798df1d57314193782f6d9cdcb (diff)
ZMQII-53: Memory leak when using invalid socket type
-rw-r--r--src/dispatcher.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/dispatcher.cpp b/src/dispatcher.cpp
index 9e713c2..b830654 100644
--- a/src/dispatcher.cpp
+++ b/src/dispatcher.cpp
@@ -134,11 +134,15 @@ zmq::socket_base_t *zmq::dispatcher_t::create_socket (int type_)
}
threads_sync.unlock ();
+ socket_base_t *s = thread->create_socket (type_);
+ if (!s)
+ return NULL;
+
term_sync.lock ();
sockets++;
term_sync.unlock ();
- return thread->create_socket (type_);
+ return s;
}
void zmq::dispatcher_t::destroy_socket ()