-fixes
[oweals/gnunet.git] / src / util / crypto_rsa.c
index 9044c3019a1250e162e1968070f124810044a078..ee7e5e9f8238acdac54b7836feba200367dacfe2 100644 (file)
@@ -36,6 +36,7 @@
 #include "gnunet_common.h"
 #include "gnunet_crypto_lib.h"
 #include "gnunet_disk_lib.h"
+#include "gnunet_strings_lib.h"
 
 #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
 
@@ -231,15 +232,15 @@ GNUNET_CRYPTO_rsa_public_key_to_string (struct GNUNET_CRYPTO_RsaPublicKeyBinaryE
     keylen += 5 - keylen % 5;
   keylen /= 5;
   pubkeybuf = GNUNET_malloc (keylen + 1);
-  end = GNUNET_STRINGS_data_to_string ((unsigned char *) &pub, 
-                                     sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), 
-                                     pubkeybuf, 
-                                     keylen);
+  end = GNUNET_STRINGS_data_to_string ((unsigned char *) pub, 
+                                      sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), 
+                                      pubkeybuf, 
+                                      keylen);
   if (NULL == end)
-    {
-      GNUNET_free (pubkeybuf);
-      return NULL;
-    }
+  {
+    GNUNET_free (pubkeybuf);
+    return NULL;
+  }
   *end = '\0';
   return pubkeybuf;
 }
@@ -807,6 +808,7 @@ GNUNET_CRYPTO_setup_hostkey (const char *cfg_name)
     pk = GNUNET_CRYPTO_rsa_key_create_from_file (fn);
     if (NULL != pk)
       GNUNET_CRYPTO_rsa_key_free (pk);
+    GNUNET_free (fn);
   }
   GNUNET_CONFIGURATION_destroy (cfg);
 }