fix comment about mq allocation
[oweals/gnunet.git] / src / util / peer.c
index 3e4e1712debd9340adccb4f8aeb2d7f3df123d42..5d54a43012ce83b19c780f2e871d62a1e855324c 100644 (file)
@@ -1,6 +1,6 @@
 /*
       This file is part of GNUnet
-     (C) 2006, 2008, 2009 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2006, 2008, 2009 GNUnet e.V.
 
       GNUnet is free software; you can redistribute it and/or modify
       it under the terms of the GNU General Public License as published
@@ -133,6 +133,7 @@ GNUNET_PEER_intern (const struct GNUNET_PeerIdentity *pid)
   }
   if (0 == ret)
   {
+    memset (&table[0]->id, 0, sizeof (struct GNUNET_PeerIdentity));
     table[0]->pid = 0;
     table[0]->rc = 1;
     ret = 1;
@@ -243,6 +244,8 @@ GNUNET_PEER_resolve (GNUNET_PEER_Id id, struct GNUNET_PeerIdentity *pid)
 const struct GNUNET_PeerIdentity *
 GNUNET_PEER_resolve2 (GNUNET_PEER_Id id)
 {
+  GNUNET_assert (id < size);
+  GNUNET_assert (table[id]->rc > 0);
   return &table[id]->id;
 }