[Freeciv-Dev] (PR#3027) uninitialized packet value from civclient.c
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
When I use valgrind on the client I get the following warning:
==12809== Conditional jump or move depends on uninitialised value(s)
==12809== at 0x80CDA7A: send_packet_generic_message (packets.c:1650)
==12809== by 0x8066E75: send_turn_done (civclient.c:520)
==12809== by 0x8066E1F: user_ended_turn (civclient.c:488)
==12809== by 0x809DBCF: end_turn_callback (gui_main.c:1197)
this is likely harmless. The location of the packet is checked against
the "special-case" (-1,-1) location. However, since this packet (the
end-turn packet) has no location these values are uninitialized. The
result is that garbage is sent to the server as the packet location.
Presumably the server ignores these values anyway.
Nonetheless, here is a patch to initialize these values to the "correct"
(-1,-1). (Just a reminder, this special-case generally means there is
no location specified, which is appropriate for this packet.)
It is possible/likely that this "problem" occurrs elsewhere.
jason
Index: client/civclient.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/civclient.c,v
retrieving revision 1.161
diff -u -r1.161 civclient.c
--- client/civclient.c 2003/02/04 23:12:30 1.161
+++ client/civclient.c 2003/02/08 11:08:12
@@ -516,6 +516,7 @@
attribute_flush();
gen_packet.message[0] = '\0';
+ gen_packet.x = gen_packet.y = -1;
send_packet_generic_message(&aconnection, PACKET_TURN_DONE, &gen_packet);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#3027) uninitialized packet value from civclient.c,
Jason Short via RT <=
|
|