From 800cb255ea7ae4e6b55095949bc84eb864c08b2e Mon Sep 17 00:00:00 2001 From: anryko Date: Sun, 7 Jan 2018 15:43:29 +0100 Subject: [PATCH] Fixed potential NULL dereference. --- src/nat/gnunet-nat.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/nat/gnunet-nat.c b/src/nat/gnunet-nat.c index b3cf2e946..72f343627 100644 --- a/src/nat/gnunet-nat.c +++ b/src/nat/gnunet-nat.c @@ -377,10 +377,16 @@ run (void *cls, ls = GNUNET_NETWORK_socket_create (af, SOCK_DGRAM, IPPROTO_UDP); + if (NULL == ls) + { + GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, + "Failed to create socket\n"); + goto fail_and_shutdown; + } if (GNUNET_OK != - GNUNET_NETWORK_socket_bind (ls, - local_sa, - local_len)) + GNUNET_NETWORK_socket_bind (ls, + local_sa, + local_len)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to bind to %s: %s\n", -- 2.25.1