make clang static analysis happy
authorChristian Grothoff <christian@grothoff.org>
Thu, 22 Apr 2010 11:25:49 +0000 (11:25 +0000)
committerChristian Grothoff <christian@grothoff.org>
Thu, 22 Apr 2010 11:25:49 +0000 (11:25 +0000)
src/peerinfo/gnunet-service-peerinfo.c
src/util/container_meta_data.c

index e200eae2f8bc458465937a6281dc6c605ff26a7a..14c914beb3a32542aa525cf4720b6d0cf6a691aa 100644 (file)
@@ -131,7 +131,8 @@ make_info_message (const struct HostEntry *he)
   im->header.type = htons (GNUNET_MESSAGE_TYPE_PEERINFO_INFO);
   im->trust = htonl (he->trust);
   im->peer = he->identity;
-  memcpy (&im[1], he->hello, hs);
+  if (he->hello != NULL)
+    memcpy (&im[1], he->hello, hs);
   return im;
 }
 
index fadb0dede2feef8e3418a9c044237f72791d8f65..89a63d659b860fd6bc7b885ef4f2af360fdaa2fd 100644 (file)
@@ -869,8 +869,9 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
   clen = 0;
   cdata = NULL;
   left = size;
+  i = 0;
   pos = md->items;
-  for (i=0;i<md->item_count;i++)
+  while (pos != NULL)
     {           
       comp = GNUNET_NO;
       if (0 == (opt & GNUNET_CONTAINER_META_DATA_SERIALIZE_NO_COMPRESS))       
@@ -967,6 +968,7 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
       if (pos->mime_type != NULL)
        left -= strlen (pos->mime_type) + 1;
       pos = pos->next;
+      i++;
     }
   GNUNET_free (ent);