fix NPE if hole-external option is not set
authorChristian Grothoff <christian@grothoff.org>
Fri, 6 Jan 2017 22:34:19 +0000 (23:34 +0100)
committerChristian Grothoff <christian@grothoff.org>
Fri, 6 Jan 2017 22:34:19 +0000 (23:34 +0100)
src/nat/gnunet-service-nat.c

index 2cb2b30ffd578d91756d4826465cb2bd94d7fcce..225d3787431ee61862e52a9fc1cc7df324bfda0d 100644 (file)
@@ -853,8 +853,9 @@ notify_client_external_ipv4_change (void *cls,
   int have_v4;
 
   /* (0) check if this impacts 'hole_external' */
-  if (0 == strcasecmp (ch->hole_external,
-                      "AUTO"))
+  if ( (NULL != ch->hole_external) &&
+       (0 == strcasecmp (ch->hole_external,
+                        "AUTO")) )
   {
     struct LocalAddressList lal;
     struct sockaddr_in *s4;
@@ -2007,7 +2008,7 @@ client_disconnect_cb (void *cls,
     GNUNET_RESOLVER_request_cancel (ch->ext_dns);
     ch->ext_dns = NULL;
   }
-  GNUNET_free (ch->hole_external);
+  GNUNET_free_non_null (ch->hole_external);
   GNUNET_free (ch->section_name);
   GNUNET_free (ch);
 }