-coverity
authorMartin Schanzenbach <mschanzenbach@posteo.de>
Wed, 20 Jun 2012 11:19:12 +0000 (11:19 +0000)
committerMartin Schanzenbach <mschanzenbach@posteo.de>
Wed, 20 Jun 2012 11:19:12 +0000 (11:19 +0000)
src/gns/gns_api.c
src/gns/gnunet-service-gns_resolver.c
src/gns/test_gns_pseu_shorten.c

index 9806082bcc26aa728eb1c52271bebd32d3246f4f..28d29f58a0a69f3c7544ec786d151b0e0fe2c91c 100644 (file)
@@ -666,6 +666,11 @@ GNUNET_GNS_lookup_zone (struct GNUNET_GNS_Handle *handle,
   size_t key_len = 0;
   char* pkey_tmp;
 
+  if (NULL == name)
+  {
+    return NULL;
+  }
+  
   if (NULL != shorten_key)
   {
     pkey_enc = GNUNET_CRYPTO_rsa_encode_key (shorten_key);
@@ -673,11 +678,6 @@ GNUNET_GNS_lookup_zone (struct GNUNET_GNS_Handle *handle,
     key_len = ntohs (pkey_enc->len);
   }
 
-  if (NULL == name)
-  {
-    return NULL;
-  }
-
   msize = sizeof (struct GNUNET_GNS_ClientLookupMessage)
     + key_len + strlen(name) + 1;
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Trying to lookup %s in GNS\n", name);
index 822c84fc342e61d1b97d735b093f872761c2c899..e14497056d969a7ebaa5e4c4974b3b01cce973c1 100644 (file)
@@ -1399,8 +1399,8 @@ handle_dns_resolver (void *cls,
   rd.flags = 0;
 
   finish_lookup (rh, rlh, 1, &rd);
-  free_resolver_handle (rh);
   GNUNET_RESOLVER_request_cancel (rh->dns_resolver_handle);
+  free_resolver_handle (rh);
 }
 
 /**
@@ -1655,6 +1655,8 @@ resolve_record_dns (struct ResolverHandle *rh,
   struct sockaddr *sa;
   int i;
   struct RecordLookupHandle *rlh = rh->proc_cls;
+
+  memset (&packet, 0, sizeof (struct GNUNET_DNSPARSER_Packet));
   
   /* We cancel here as to not include the ns lookup in the timeout */
   if (rh->timeout_task != GNUNET_SCHEDULER_NO_TASK)
@@ -2516,8 +2518,9 @@ handle_record_ns (void* cls, struct ResolverHandle *rh,
      *    would already have an entry in the NS for the record)
      * 5. We are not in cache only mode
      */
-    if (((rh->status & RSL_RECORD_EXPIRED) || (rh->status &!RSL_RECORD_EXISTS))
-        && GNUNET_CRYPTO_short_hash_cmp(&rh->authority_chain_head->zone,
+    if (( ((rh->status & RSL_RECORD_EXPIRED) != 0) ||
+         ((rh->status & RSL_RECORD_EXISTS) == 0) ) &&
+        GNUNET_CRYPTO_short_hash_cmp(&rh->authority_chain_head->zone,
                                         &rh->private_local_zone) &&
         (strcmp(rh->name, "+") == 0) &&
         (rh->only_cached == GNUNET_NO))
index 0f1150bab81a419c633cd0561da7a58c45a52900..1e662c1b832a988fa8bea5624e7467606b43902e 100644 (file)
@@ -289,6 +289,7 @@ put_pseu_dht(void *cls, int success)
   struct GNUNET_CRYPTO_RsaSignature *sig;
   struct GNUNET_NAMESTORE_RecordData rd;
   
+  memset (&rd, 0, sizeof (struct GNUNET_NAMESTORE_RecordData));
   rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value;
   rd.data_size = strlen(TEST_PSEU_ALICE)+1;
   rd.data = TEST_PSEU_ALICE;