[Freeciv-Dev] [bug #19104] [traits] in sanity_check_size() [mem.c::61]: Warning: malloc with size 0
Update of bug #19104 (project freeciv): Status: Ready For Test = Fixed Open/Closed:Open = Closed ___ 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
[Freeciv-Dev] [bug #19104] [traits] in sanity_check_size() [mem.c::61]: Warning: malloc with size 0
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
[Freeciv-Dev] [bug #19104] [traits] in sanity_check_size() [mem.c::61]: Warning: malloc with size 0
Update of bug #19104 (project freeciv): Status: In Progress = Ready For Test ___ Additional Item Attachment: File name: trunk-trait-nation-alloc.diff Size:0 KB ___ 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
[Freeciv-Dev] [bug #19104] [traits] in sanity_check_size() [mem.c::61]: Warning: malloc with size 0
Follow-up Comment #1, bug #19104 (project freeciv): On second thoughts, let's use fc_calloc(). We don't need the zeroing, but otherwise it's tidier. (file #14641) ___ Additional Item Attachment: File name: trunk-trait-nation-alloc-bis.diff Size:0 KB ___ 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