-fixes
authorMartin Schanzenbach <mschanzenbach@posteo.de>
Fri, 16 Mar 2012 09:16:58 +0000 (09:16 +0000)
committerMartin Schanzenbach <mschanzenbach@posteo.de>
Fri, 16 Mar 2012 09:16:58 +0000 (09:16 +0000)
src/gns/gns_api.c
src/gns/gnunet-service-gns_resolver.c
src/gns/test_gns_simple_delegated_lookup.c
src/gns/test_gns_simple_lookup.c
src/gns/test_gns_simple_shorten.c

index 26870cdfddf7302d53744720c7538c76063b415a..5733e1cf347a89c104409cba931e18bda50208ea 100644 (file)
@@ -362,6 +362,7 @@ process_shorten_reply (struct GNUNET_GNS_QueueEntry *qe,
   {
     GNUNET_break (0);
     force_reconnect (h);
+    GNUNET_free(qe);
     return;
   }
   
@@ -372,6 +373,7 @@ process_shorten_reply (struct GNUNET_GNS_QueueEntry *qe,
   GNUNET_CLIENT_receive (h->client, &process_message, h,
                          GNUNET_TIME_UNIT_FOREVER_REL);
   qe->shorten_proc(qe->proc_cls, short_name);
+  GNUNET_free(qe);
 
 }
 
@@ -397,6 +399,7 @@ process_get_auth_reply (struct GNUNET_GNS_QueueEntry *qe,
   if (ntohs (((struct GNUNET_MessageHeader*)msg)->size) <
       sizeof (struct GNUNET_GNS_ClientGetAuthResultMessage))
   {
+    GNUNET_free(qe);
     GNUNET_break (0);
     force_reconnect (h);
     return;
@@ -409,6 +412,7 @@ process_get_auth_reply (struct GNUNET_GNS_QueueEntry *qe,
   GNUNET_CLIENT_receive (h->client, &process_message, h,
                          GNUNET_TIME_UNIT_FOREVER_REL);
   qe->auth_proc(qe->proc_cls, auth_name);
+  GNUNET_free(qe);
 
 }
 /**
@@ -433,6 +437,7 @@ process_lookup_reply (struct GNUNET_GNS_QueueEntry *qe,
 
   if (len < sizeof (struct GNUNET_GNS_ClientLookupResultMessage))
   {
+    GNUNET_free(qe);
     GNUNET_break (0);
     force_reconnect (h);
     return;
@@ -459,6 +464,7 @@ process_lookup_reply (struct GNUNET_GNS_QueueEntry *qe,
                 ntohl(msg->rd_count));
     qe->lookup_proc(qe->proc_cls, rd_count, rd);
   }
+  GNUNET_free(qe);
 }
 
 /**
index a46a2fd617e6fba468e3ac17882d5f19de2d52b8..0b11e980f1ee282d8f90935f80fe08fb8726df91 100644 (file)
@@ -56,6 +56,10 @@ static struct GNUNET_DHT_Handle *dht_handle;
 
 /**
  * Initialize the resolver
+ *
+ * @param nh the namestore handle
+ * @param dh the dht handle
+ * @return GNUNET_OK on success
  */
 int
 gns_resolver_init(struct GNUNET_NAMESTORE_Handle *nh,
@@ -70,6 +74,18 @@ gns_resolver_init(struct GNUNET_NAMESTORE_Handle *nh,
   return GNUNET_SYSERR;
 }
 
+/**
+ * Set the callback to call when we discover a
+ * new authority via the DHT
+ *
+ * @param adb the callback to set
+ *
+void
+gns_resolver_set_auth_discovered_cb(AuthorityDiscoveredProcessor adb)
+{
+  auth_discovered = adb;
+}
+*/
 
 /**
  * Helper function to free resolver handle
index 2bbc875846fe294eb87da013f027735019adb564..ea1206b9bbba99a0fd531805e4868ed8bedee01d 100644 (file)
@@ -270,7 +270,9 @@ do_lookup(void *cls, const struct GNUNET_PeerIdentity *id,
                                sig,
                                &commence_testing,
                                NULL);
-
+  GNUNET_free(sig);
+  GNUNET_CRYPTO_rsa_key_free(bob_key);
+  GNUNET_CRYPTO_rsa_key_free(alice_key);
 }
 
 static void
index 8bd33fc472999732e41a75f3069027556d0bc4ee..e93de1a6638f8926b3ad6a3228594f0f74c8733c 100644 (file)
@@ -229,6 +229,8 @@ do_lookup(void *cls, const struct GNUNET_PeerIdentity *id,
   alice_key = GNUNET_CRYPTO_rsa_key_create_from_file (alice_keyfile);
 
   GNUNET_CRYPTO_rsa_key_get_public (alice_key, &alice_pkey);
+  
+  GNUNET_free(alice_keyfile);
 
   struct GNUNET_NAMESTORE_RecordData rd;
   char* ip = TEST_IP;
@@ -245,6 +247,9 @@ do_lookup(void *cls, const struct GNUNET_PeerIdentity *id,
                                   &rd,
                                   &commence_testing,
                                   NULL);
+  
+  GNUNET_CRYPTO_rsa_key_free(alice_key);
+  GNUNET_free(web);
 
 }
 
index c444dfe875b3672655b1eea907311c4749cccb59..27a0024dc4a638f3ad7105836dcd1c050ce820b1 100644 (file)
@@ -254,7 +254,9 @@ do_shorten(void *cls, const struct GNUNET_PeerIdentity *id,
   /* put alice into bobs zone */
   GNUNET_CRYPTO_hash(&alice_pkey, sizeof(alice_pkey), &alice_hash);
   rd.data = &alice_hash;
-  sig = GNUNET_NAMESTORE_create_signature(bob_key, GNUNET_TIME_absolute_get_forever(), TEST_AUTHORITY_ALICE,
+  sig = GNUNET_NAMESTORE_create_signature(bob_key,
+                                          GNUNET_TIME_absolute_get_forever(),
+                                          TEST_AUTHORITY_ALICE,
                                           &rd, 1);
 
   GNUNET_NAMESTORE_record_put (namestore_handle,
@@ -266,13 +268,15 @@ do_shorten(void *cls, const struct GNUNET_PeerIdentity *id,
                                sig,
                                NULL,
                                NULL);
-
+  GNUNET_free(sig);
   /* put www A record and PSEU into alice's zone */
 
   rd.data_size = sizeof(struct in_addr);
   rd.data = web;
   rd.record_type = GNUNET_DNSPARSER_TYPE_A;
-  sig = GNUNET_NAMESTORE_create_signature(alice_key,GNUNET_TIME_absolute_get_forever(),  TEST_RECORD_NAME,
+  sig = GNUNET_NAMESTORE_create_signature(alice_key,
+                                          GNUNET_TIME_absolute_get_forever(),
+                                          TEST_RECORD_NAME,
                                           &rd, 1);
 
   GNUNET_NAMESTORE_record_put (namestore_handle,
@@ -284,7 +288,7 @@ do_shorten(void *cls, const struct GNUNET_PeerIdentity *id,
                                sig,
                                NULL,
                                NULL);
-
+  
   rd.data_size = sizeof(GNUNET_HashCode);
   rd.data = &alice_hash;
   rd.record_type = GNUNET_GNS_RECORD_PKEY;
@@ -297,7 +301,10 @@ do_shorten(void *cls, const struct GNUNET_PeerIdentity *id,
                                &commence_testing,
                                NULL);
 
-
+  GNUNET_free(web);
+  GNUNET_CRYPTO_rsa_key_free(our_key);
+  GNUNET_CRYPTO_rsa_key_free(bob_key);
+  GNUNET_CRYPTO_rsa_key_free(alice_key);
 }
 
 static void