From 6119925f2e9a14f795153c78dc88550ce24f4f90 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 22 Apr 2010 11:25:49 +0000 Subject: [PATCH] make clang static analysis happy --- src/peerinfo/gnunet-service-peerinfo.c | 3 ++- src/util/container_meta_data.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/peerinfo/gnunet-service-peerinfo.c b/src/peerinfo/gnunet-service-peerinfo.c index e200eae2f..14c914beb 100644 --- a/src/peerinfo/gnunet-service-peerinfo.c +++ b/src/peerinfo/gnunet-service-peerinfo.c @@ -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; } diff --git a/src/util/container_meta_data.c b/src/util/container_meta_data.c index fadb0dede..89a63d659 100644 --- a/src/util/container_meta_data.c +++ b/src/util/container_meta_data.c @@ -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;iitem_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); -- 2.25.1