From 2b61888a0bf1d41b2b25256ca9834c3040551ce9 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 25 Jun 2010 18:15:30 +0000 Subject: [PATCH] fix --- src/fs/fs_uri.c | 1 + src/fs/gnunet-service-fs.c | 15 +++++---------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/fs/fs_uri.c b/src/fs/fs_uri.c index 8f9fbba65..96a1414fe 100644 --- a/src/fs/fs_uri.c +++ b/src/fs/fs_uri.c @@ -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) diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index 1eb491877..788817f5b 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c @@ -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) { -- 2.25.1