nitpicks
authorChristian Grothoff <christian@grothoff.org>
Sun, 15 Aug 2010 13:51:03 +0000 (13:51 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sun, 15 Aug 2010 13:51:03 +0000 (13:51 +0000)
src/fs/fs.c
src/fs/gnunet-service-fs.c
src/fs/gnunet-service-fs_indexing.c
src/hostlist/hostlist-client.c

index d7213b402e856bc84c61454f6de61642f9f2e35a..accaafac4997969712470a1547105adc1c10c54e 100644 (file)
@@ -2217,6 +2217,7 @@ deserialize_search_result (void *cls,
   emsg = NULL;
   uris = NULL;
   download = NULL;
+  update_srch = NULL;
   sr = GNUNET_malloc (sizeof (struct GNUNET_FS_SearchResult));
   sr->serialization = ser;  
   if ( (GNUNET_OK !=
@@ -2288,7 +2289,7 @@ deserialize_search_result (void *cls,
              GNUNET_free (emsg);
            }
        }
-      GNUNET_free (update_srch);      
+      GNUNET_free (update_srch);     
     }
   GNUNET_CONTAINER_multihashmap_put (sc->master_result_map,
                                     &sr->key,
@@ -2308,6 +2309,7 @@ deserialize_search_result (void *cls,
   GNUNET_free_non_null (download);
   GNUNET_free_non_null (emsg);
   GNUNET_free_non_null (uris);
+  GNUNET_free_non_null (update_srch);     
   if (sr->uri != NULL)
     GNUNET_FS_uri_destroy (sr->uri);
   if (sr->meta != NULL)
index 63c90850dbd37b97c6327654464c538e0a056b02..83bbea183fe9fa3a2951f7cbd623ce2c78f676ea 100644 (file)
@@ -3456,6 +3456,7 @@ handle_p2p_get (void *cls,
   if (GNUNET_CONTAINER_heap_get_size (requests_by_expiration_heap) > max_pending_requests)
     {
       pr = GNUNET_CONTAINER_heap_peek (requests_by_expiration_heap);
+      GNUNET_assert (pr != NULL);
       destroy_pending_request (pr);
     }
   return GNUNET_OK;
index 833169792f5ef8c0ba7ef2e706384d114bdede66..20350f8fc60b276dee078fb8b676b0e551fdca9b 100644 (file)
@@ -214,7 +214,8 @@ read_index_list ()
           GNUNET_BIO_read_string (rh, 
                                   "Name of indexed file",
                                   &fname,
-                                  1024 * 16)) )
+                                  1024 * 16)) &&
+         (fname != NULL) )
     {
       slen = strlen (fname) + 1;
       pos = GNUNET_malloc (sizeof (struct IndexInfo) + slen);
index b4d86e052d8ae12db91bde90e1b768bf4ed4e196..e080fdccddcc81789b26a48d7f98faf1fcaf8843 100644 (file)
@@ -149,7 +149,7 @@ static CURL *curl;
 static CURLM *multi;
 
 /**
- *
+ * How many bytes did we download from the current hostlist URL?
  */
 static uint32_t stat_bytes_downloaded;
 /**
@@ -574,39 +574,32 @@ linked_list_get_lowest_quality ( )
  * Method to insert a hostlist into the datastore. If datastore contains maximum number of elements, the elements with lowest quality is dismissed
  */
 static void
-insert_hostlist ( void )
+insert_hostlist ( )
 {
-  GNUNET_CONTAINER_DLL_insert(linked_list_head, linked_list_tail, hostlist_to_test);
-  linked_list_size++;
-
-  GNUNET_STATISTICS_set (stats,
-                         gettext_noop("# advertised hostlist URIs"),
-                         linked_list_size,
-                         GNUNET_NO);
-
-  if (MAX_NUMBER_HOSTLISTS >= linked_list_size)
-    return;
-
-  /* No free entries available, replace existing entry  */
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Removing lowest quality entry\n" );
-  struct Hostlist * lowest_quality = linked_list_get_lowest_quality();
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Hostlist with URI `%s' has the worst quality of all with value %llu\n",
-              lowest_quality->hostlist_uri,
-              (unsigned long long) lowest_quality->quality);
-  GNUNET_CONTAINER_DLL_remove (linked_list_head, linked_list_tail, lowest_quality);
-  linked_list_size--;
+  struct Hostlist * lowest_quality;
 
+  if (MAX_NUMBER_HOSTLISTS <= linked_list_size)
+    {
+      /* No free entries available, replace existing entry  */
+      lowest_quality = linked_list_get_lowest_quality();
+      GNUNET_assert (lowest_quality != NULL);
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                 "Removing hostlist with URI `%s' which has the worst quality of all (%llu)\n",
+                 lowest_quality->hostlist_uri,
+                 (unsigned long long) lowest_quality->quality);
+      GNUNET_CONTAINER_DLL_remove (linked_list_head, linked_list_tail, lowest_quality);
+      linked_list_size--;
+      GNUNET_free (lowest_quality);
+    }
+  GNUNET_CONTAINER_DLL_insert(linked_list_head,
+                             linked_list_tail,
+                             hostlist_to_test);
+  linked_list_size++;
   GNUNET_STATISTICS_set (stats,
                          gettext_noop("# advertised hostlist URIs"),
                          linked_list_size,
                          GNUNET_NO);
-
-  GNUNET_free (lowest_quality);
-
   stat_testing_hostlist = GNUNET_NO;
-  return;
 }