mleak: fixed memory leak when socket allocated, but init returs failure.
diff --git a/src/core/global.c b/src/core/global.c
index 8fc13c2..9fc55ea 100644
--- a/src/core/global.c
+++ b/src/core/global.c
@@ -403,7 +403,7 @@
     if (headsz + NN_CMSG_SPACE (0) > sz ||
           headsz + NN_CMSG_ALIGN_ (next->cmsg_len) > sz)
         return NULL;
-    
+
     /*  Success. */
     return next;
 }
@@ -439,8 +439,10 @@
             if ((sock = nn_alloc (sizeof (struct nn_sock), "sock")) == NULL)
                 return -ENOMEM;
             rc = nn_sock_init (sock, socktype, s);
-            if (rc < 0)
+            if (rc < 0) {
+                nn_free (sock);
                 return rc;
+            }
 
             /*  Adjust the global socket table. */
             self.socks [s] = sock;