Follow-up Comment #2, bug #15305 (project freeciv):

You are right about the reallocs.  Instead of calling this a "leak" I should
have said "map_allocate() relies on process exit to free some of its memory"
or something like that.  I admit I don't understand why realloc is used in
the index arrays instead of malloc/free.

Why are the index arrays treated differently than the tiles array?

By freeing the index arrays and setting them to NULL, the patch subverts the
original intent to reuse memory.  Therefore the reallocs probably also ought
to be changed to regular mallocs to make it clear what is happening, and the
comment about realloc in generate_citymap_index() should be deleted.

I guess it wasn't a very good patch.  The original code was written by jdorje
and glip back in 2004.  Hopefully they can tell us what is the right thing to
do.

JKL

    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  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