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.
On Thu, Dec 8, 2011 at 3:48 AM, Lucas Beyer <[email protected]> wrote: > Dear list, > > I have come to the habit of running my small programs through valgrind. > One error being reported comes from enet. > > This is the valgrind output: > > ==18627== Syscall param socketcall.sendmsg(msg.msg_iov[i]) points to > uninitialised byte(s) > ==18627== at 0x56816B0: __sendmsg_nocancel (in /lib64/libc-2.14.1.so) > ==18627== by 0x40D5C5: enet_socket_send (in > /windows/Xchange/fts/scm/git/fts/gamedbg/build-d/fts-gamedbg) > ==18627== by 0x40CBFF: enet_protocol_send_outgoing_commands (in > /windows/Xchange/fts/scm/git/fts/gamedbg/build-d/fts-gamedbg) > ==18627== by 0x40CEB6: enet_host_service (in > /windows/Xchange/fts/scm/git/fts/gamedbg/build-d/fts-gamedbg) > ==18627== by 0x4045E4: main (in > /windows/Xchange/fts/scm/git/fts/gamedbg/build-d/fts-gamedbg) > ==18627== Address 0x593614c is 156 bytes inside a block of size 10,976 > alloc'd > ==18627== at 0x4C297CD: malloc (in > /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) > ==18627== by 0x40D8B7: enet_malloc (in > /windows/Xchange/fts/scm/git/fts/gamedbg/build-d/fts-gamedbg) > ==18627== by 0x405C2D: enet_host_create (in > /windows/Xchange/fts/scm/git/fts/gamedbg/build-d/fts-gamedbg) > ==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) > ==18627== by 0x40455E: main (in > /windows/Xchange/fts/scm/git/fts/gamedbg/build-d/fts-gamedbg) > ==18627== Uninitialised value was created by a heap allocation > ==18627== at 0x4C297CD: malloc (in > /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) > ==18627== by 0x40D8B7: enet_malloc (in > /windows/Xchange/fts/scm/git/fts/gamedbg/build-d/fts-gamedbg) > ==18627== by 0x405C2D: enet_host_create (in > /windows/Xchange/fts/scm/git/fts/gamedbg/build-d/fts-gamedbg) > ==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) > ==18627== by 0x40455E: main (in > /windows/Xchange/fts/scm/git/fts/gamedbg/build-d/fts-gamedbg) > > 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: > > --- host.c.orig 2011-12-08 12:25:44.187125000 +0100 > +++ host.c 2011-12-08 12:23:43.661363000 +0100 > @@ -38,6 +38,7 @@ > host = (ENetHost *) enet_malloc (sizeof (ENetHost)); > if (host == NULL) > return NULL; > + memset (host, 0, sizeof (ENetHost)); > > host -> peers = (ENetPeer *) enet_malloc (peerCount * sizeof > (ENetPeer)); > if (host -> peers == NULL) > > I also attached the patch as a file to this email. > > -- > Kind regards, Lucas > http://arkana-fts.org > > _______________________________________________ > ENet-discuss mailing list > [email protected] > http://lists.cubik.org/mailman/listinfo/enet-discuss > >
_______________________________________________ ENet-discuss mailing list [email protected] http://lists.cubik.org/mailman/listinfo/enet-discuss
