diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-05-16 08:56:04 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-05-16 08:56:04 +0000 |
commit | 457444c91f2566d2002df0d411055d8b06c7db31 (patch) | |
tree | fe9f101749472235e489de6974e42c1390c48dd2 /src/transport/plugin_transport_udp.c | |
parent | 378b1d8e50569437edb4ce1455396952b4e68d2c (diff) | |
download | gnunet-457444c91f2566d2002df0d411055d8b06c7db31.tar.gz gnunet-457444c91f2566d2002df0d411055d8b06c7db31.zip |
-fix crash if UDP port is in use
Diffstat (limited to 'src/transport/plugin_transport_udp.c')
-rw-r--r-- | src/transport/plugin_transport_udp.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index 28ebf96e3..53e884979 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -2859,6 +2859,8 @@ setup_sockets (struct Plugin *plugin, | |||
2859 | GNUNET_NETWORK_fdset_set (plugin->ws_v6, plugin->sockv6); | 2859 | GNUNET_NETWORK_fdset_set (plugin->ws_v6, plugin->sockv6); |
2860 | } | 2860 | } |
2861 | } | 2861 | } |
2862 | if (0 == sockets_created) | ||
2863 | return 0; | ||
2862 | schedule_select (plugin); | 2864 | schedule_select (plugin); |
2863 | plugin->nat = GNUNET_NAT_register (plugin->env->cfg, | 2865 | plugin->nat = GNUNET_NAT_register (plugin->env->cfg, |
2864 | GNUNET_NO, plugin->port, | 2866 | GNUNET_NO, plugin->port, |
@@ -3035,10 +3037,12 @@ libgnunet_plugin_transport_udp_init (void *cls) | |||
3035 | 3037 | ||
3036 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Setting up sockets\n"); | 3038 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Setting up sockets\n"); |
3037 | res = setup_sockets (p, (GNUNET_YES == have_bind6) ? &serverAddrv6 : NULL, | 3039 | res = setup_sockets (p, (GNUNET_YES == have_bind6) ? &serverAddrv6 : NULL, |
3038 | (GNUNET_YES == have_bind4) ? &serverAddrv4 : NULL); | 3040 | (GNUNET_YES == have_bind4) ? &serverAddrv4 : NULL); |
3039 | if ((res == 0) || ((p->sockv4 == NULL) && (p->sockv6 == NULL))) | 3041 | if ((res == 0) || ((p->sockv4 == NULL) && (p->sockv6 == NULL))) |
3040 | { | 3042 | { |
3041 | LOG (GNUNET_ERROR_TYPE_ERROR, "Failed to create network sockets, plugin failed\n"); | 3043 | /* FIXME: memory leaks here! (i.e. p->mst, sessions, defrag_ctxs, etc.) */ |
3044 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
3045 | _("Failed to create network sockets, plugin failed\n")); | ||
3042 | MEMDEBUG_free (p, __LINE__); | 3046 | MEMDEBUG_free (p, __LINE__); |
3043 | MEMDEBUG_free (api, __LINE__); | 3047 | MEMDEBUG_free (api, __LINE__); |
3044 | return NULL; | 3048 | return NULL; |