URL:
  <http://gna.org/bugs/?19104>

                 Summary: [traits] in sanity_check_size() [mem.c::61]:
Warning: malloc with size 0
                 Project: Freeciv
            Submitted by: jtn
            Submitted on: Sat Dec  3 18:11:10 2011
                Category: general
                Severity: 3 - Normal
                Priority: 5 - Normal
                  Status: In Progress
             Assigned to: jtn
        Originator Email: 
             Open/Closed: Open
                 Release: 
         Discussion Lock: Any
        Operating System: Any
         Planned Release: 2.5.0

    _______________________________________________________

Details:

Running a trunk server with "-d 3" gives a bunch of the quoted message.

This is due to an off-by-one when malloc'ing space for nation traits (there's
currently one, "placeholder", but we malloc k*trait_max() where trait_max() is
0).

This presumably doesn't lead to segfaults because fc_real_malloc() suppresses
the allowed/common C behaviour of returning NULL from malloc(0) (although it's
still malloc'ing only 1 char, not sizeof(int)).




    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?19104>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to