-fix
[oweals/gnunet.git] / src / gns / gnunet-gns.c
index 21cc50c26c9190b539b56068efd1b277dc4e2af4..0524b3def4424420a31d4069162a1f5f10692f31 100644 (file)
@@ -242,7 +242,7 @@ run (void *cls, char *const *args, const char *cfgfile,
     if (!raw)
       GNUNET_log (GNUNET_ERROR_TYPE_INFO,
                   "No private zone key file name specified in configuration!\n");
-    shorten_key = NULL;
+    private_key = NULL;
   }
   else
   {
@@ -287,10 +287,15 @@ run (void *cls, char *const *args, const char *cfgfile,
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                _("Failed to connect to GNS\n"));
+    if (NULL != shorten_key)
+    {
+      GNUNET_CRYPTO_rsa_key_free (shorten_key);
+      shorten_key = NULL;
+    }
     return;
   }
   
-  if (NULL != shorten_name)
+  if ((NULL != shorten_name) && (NULL != shorten_zone) && (NULL != private_zone))
   {
     shorten_request = GNUNET_GNS_shorten_zone (gns, shorten_name,
                              private_zone,