Hello,

I'm submitting a patch under the MIT/X11 license.
It improves the null checking in zmq_term().

-- 
Ivo Danihelka
diff --git a/src/zmq.cpp b/src/zmq.cpp
index e9bfc53..8f332b4 100644
--- a/src/zmq.cpp
+++ b/src/zmq.cpp
@@ -269,13 +269,15 @@ void *zmq_init (int io_threads_)
 
 int zmq_term (void *ctx_)
 {
-    int rc = ((zmq::ctx_t*) ctx_)->terminate ();
-    int en = errno;
-
+    int rc;
+    int en;
     if (!ctx_) {
         errno = EFAULT;
         return -1;
     }
+    rc = ((zmq::ctx_t*) ctx_)->terminate ();
+    en = errno;
+
 #if defined ZMQ_HAVE_OPENPGM
     //  Shut down the OpenPGM library.
     if (pgm_shutdown () != TRUE)
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to