Summary: missing initialization in send_city_info_at_tile()
(found by valgrind)
                 Project: Freeciv
            Submitted by: anbe
            Submitted on: Thursday 02/11/2010 at 11:10
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
                  Status: None
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
                 Release: S2_2
         Discussion Lock: Any
        Operating System: GNU/Linux
         Planned Release: 



running freeciv-server (S2_2, r16785) in valgrind reveals the following

Conditional jump or move depends on uninitialised value(s)
   at 0x4C71A5: send_packet_city_info_100 (packets_gen.c:7176)
   by 0x4C811C: send_packet_city_info (packets_gen.c:7525)
   by 0x4C818C: lsend_packet_city_info (packets_gen.c:7533)
   by 0x446892: send_city_info_at_tile (citytools.c:1755)
   by 0x446696: send_all_known_cities (citytools.c:1666)
   by 0x407D5F: send_all_info (srv_main.c:414)
   by 0x40BFA6: srv_ready (srv_main.c:2384)
   by 0x40C1D9: srv_main (srv_main.c:2460)
   by 0x404867: main (civserver.c:359)
 Uninitialised value was created by a stack allocation
   at 0x4467D0: send_city_info_at_tile (citytools.c:1737)

This is caused by a missing initialization of
in the function send_city_info_at_tile() where this initialization should
occur between packet->turn_last_built and packet->changed_from_kind
(following the order of packets_gen.c)
(Also the order of initializing turn_founded and turn_last_built may be
swapped to better match packets_gen.c). 

If there is currently no real value available, the variable should be
initialized to some dummy (e.g. 0 or -1) for generating consistent packet



Reply to this item at:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to