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

good catch! It's best to free allocated memory within the code.

As I'm not so familiar with pointers and allocation of memory a question to
the functions used:

For both pointers (city_map_index and map.iterate_outwards_indices)
fc_realloc (freeciv wrapper for realloc) is used. If I'm right, this means
that, independent how often the functions are called, only one pointer with
the last requested memory size is allocated. So even if the allocations
happens quit often, it wouldn't be a big memory leak.

Comments to the patch:

* please do not insert trailing whitespaces to the code.
* freeciv also defines FC_FREE, a wrapper for free()

#define FC_FREE(ptr) do { free(ptr); (ptr) = NULL; } while(0)



    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  Nachricht geschickt von/durch Gna!
  http://gna.org/


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

Reply via email to