fix
authorChristian Grothoff <christian@grothoff.org>
Fri, 25 Jun 2010 18:15:30 +0000 (18:15 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 25 Jun 2010 18:15:30 +0000 (18:15 +0000)
src/fs/fs_uri.c
src/fs/gnunet-service-fs.c

index 8f9fbba65b8ab844467ed4d7828f571581142804..96a1414fe144807943aaabc6a62dcd88a2bd2b79 100644 (file)
@@ -1094,6 +1094,7 @@ GNUNET_FS_uri_dup (const struct GNUNET_FS_Uri *uri)
       if (ret->data.ksk.keywordCount >= GNUNET_MAX_MALLOC_CHECKED / sizeof (char*))
        {
          GNUNET_break (0);
+         GNUNET_free (ret);
          return NULL;
        }
       if (ret->data.ksk.keywordCount > 0)
index 1eb491877ef81c11c8174ca6f88f74aaf9eead85..788817f5b0adcf326d8de832d08cc817d44eec65 100644 (file)
@@ -2614,7 +2614,6 @@ handle_p2p_put (void *cls,
   GNUNET_HashCode query;
   struct ProcessReplyClosure prq;
   const struct SBlock *sb;
-  struct ConnectedPeer *cps;
 
   msize = ntohs (message->size);
   if (msize < sizeof (struct PutMessage))
@@ -2661,6 +2660,8 @@ handle_p2p_put (void *cls,
   if (other != NULL)
     prq.sender = GNUNET_CONTAINER_multihashmap_get (connected_peers,
                                                    &other->hashPubKey);
+  else
+    prq.sender = NULL;
   prq.size = dsize;
   prq.type = type;
   prq.expiration = expiration;
@@ -2670,16 +2671,10 @@ handle_p2p_put (void *cls,
                                              &query,
                                              &process_reply,
                                              &prq);
-  cps = GNUNET_CONTAINER_multihashmap_get (connected_peers,
-                                          &other->hashPubKey);
-  if (cps != NULL)
+  if (prq.sender != NULL)
     {
-      cps->inc_preference += CONTENT_BANDWIDTH_VALUE + 1000 * prq.priority;
-      cps->trust_delta += prq.priority;
-    }
-  else
-    {
-      GNUNET_break (0);
+      prq.sender->inc_preference += CONTENT_BANDWIDTH_VALUE + 1000 * prq.priority;
+      prq.sender->trust_delta += prq.priority;
     }
   if (GNUNET_YES == active_migration)
     {