Committed to CVS. It's just complaining about some of the ENetBuffer structs being uninitialized even though they are outside the count passed to sendmsg.<br><br><div class="gmail_quote">On Thu, Dec 8, 2011 at 3:48 AM, Lucas Beyer <span dir="ltr"><<a href="mailto:pompei2@gmail.com">pompei2@gmail.com</a>></span> wrote:<br>
<blockquote style="margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-style: solid;" class="gmail_quote">Dear list,<br><br>I have come to the habit of running my small programs through valgrind. One error being reported comes from enet.<br>
<br>This is the valgrind output:<br><br>==18627== Syscall param socketcall.sendmsg(msg.msg_iov[i]) points to uninitialised byte(s)<br>
==18627==    at 0x56816B0: __sendmsg_nocancel (in /lib64/<a href="http://libc-2.14.1.so" target="_blank">libc-2.14.1.so</a>)<br>==18627==    by 0x40D5C5: enet_socket_send (in /windows/Xchange/fts/scm/git/fts/gamedbg/build-d/fts-gamedbg)<br>

==18627==    by 0x40CBFF: enet_protocol_send_outgoing_commands (in /windows/Xchange/fts/scm/git/fts/gamedbg/build-d/fts-gamedbg)<br>==18627==    by 0x40CEB6: enet_host_service (in /windows/Xchange/fts/scm/git/fts/gamedbg/build-d/fts-gamedbg)<br>

==18627==    by 0x4045E4: main (in /windows/Xchange/fts/scm/git/fts/gamedbg/build-d/fts-gamedbg)<br>==18627==  Address 0x593614c is 156 bytes inside a block of size 10,976 alloc'd<br>==18627==    at 0x4C297CD: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)<br>

==18627==    by 0x40D8B7: enet_malloc (in /windows/Xchange/fts/scm/git/fts/gamedbg/build-d/fts-gamedbg)<br>==18627==    by 0x405C2D: enet_host_create (in /windows/Xchange/fts/scm/git/fts/gamedbg/build-d/fts-gamedbg)<br>==18627==    by 0x405190: enet::Client::Client(std::string const&, unsigned short, double, unsigned long, unsigned int, unsigned int) (in /windows/Xchange/fts/scm/git/fts/gamedbg/build-d/fts-gamedbg)<br>

==18627==    by 0x40455E: main (in /windows/Xchange/fts/scm/git/fts/gamedbg/build-d/fts-gamedbg)<br>==18627==  Uninitialised value was created by a heap allocation<br>==18627==    at 0x4C297CD: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)<br>

==18627==    by 0x40D8B7: enet_malloc (in /windows/Xchange/fts/scm/git/fts/gamedbg/build-d/fts-gamedbg)<br>==18627==    by 0x405C2D: enet_host_create (in /windows/Xchange/fts/scm/git/fts/gamedbg/build-d/fts-gamedbg)<br>==18627==    by 0x405190: enet::Client::Client(std::string const&, unsigned short, double, unsigned long, unsigned int, unsigned int) (in /windows/Xchange/fts/scm/git/fts/gamedbg/build-d/fts-gamedbg)<br>

==18627==    by 0x40455E: main (in /windows/Xchange/fts/scm/git/fts/gamedbg/build-d/fts-gamedbg)<br><br>I have looked into it for a little time and am now pretty confident it's not because of an usage error I made. My code is pretty simple and based on the tutorial. Applying the following patch fixes it for me:<br>

<br>--- host.c.orig    2011-12-08 12:25:44.187125000 +0100<br>+++ host.c    2011-12-08 12:23:43.661363000 +0100<br>@@ -38,6 +38,7 @@<br>     host = (ENetHost *) enet_malloc (sizeof (ENetHost));<br>     if (host == NULL)<br>

       return NULL;<br>+    memset (host, 0, sizeof (ENetHost));<br> <br>     host -> peers = (ENetPeer *) enet_malloc (peerCount * sizeof (ENetPeer));<br>     if (host -> peers == NULL)<br><br>I also attached the patch as a file to this email.<span class="HOEnZb"><font color="#888888"><br>

<br>-- <br>Kind regards, Lucas<br><a href="http://arkana-fts.org" target="_blank">http://arkana-fts.org</a><br>

</font></span><br>_______________________________________________<br>
ENet-discuss mailing list<br>
<a href="mailto:ENet-discuss@cubik.org">ENet-discuss@cubik.org</a><br>
<a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/mailman/listinfo/enet-discuss</a><br>
<br></blockquote></div><br>