log
[oweals/gnunet.git] / src / transport / plugin_transport_unix.c
index 036096f6d8e325a051a2ea0f94a3c7e866d5e1ab..a7cbbf39c7e6be9f473d7c038e65e25ea33b07b5 100644 (file)
@@ -880,6 +880,7 @@ unix_plugin_get_session (void *cls,
   s = GNUNET_new (struct Session);
   s->target = address->peer;
   s->address = GNUNET_HELLO_address_copy (address);
+  s->plugin = plugin;
   GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == s->timeout_task);
   s->timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
                                                  &session_timeout,
@@ -1671,9 +1672,15 @@ libgnunet_plugin_transport_unix_init (void *cls)
   api->get_network = &unix_get_network;
   api->update_session_timeout = &unix_plugin_update_session_timeout;
   sockets_created = unix_transport_server_start (plugin);
-  if (0 == sockets_created)
+  if ((0 == sockets_created) || (GNUNET_SYSERR == sockets_created))
+  {
     LOG (GNUNET_ERROR_TYPE_WARNING,
         _("Failed to open UNIX listen socket\n"));
+    GNUNET_free (api);
+    GNUNET_free (plugin->unix_socket_path);
+    GNUNET_free (plugin);
+    return NULL;
+  }
   plugin->session_map = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO);
   plugin->address_update_task = GNUNET_SCHEDULER_add_now (&address_notification, plugin);
   return api;