Summary: Minor memory leaks due to sg_failure_ret()
                 Project: Freeciv
            Submitted by: jtn
            Submitted on: Thu Jul 14 01:00:00 2011
                Category: general
                Severity: 2 - Minor
                Priority: 5 - Normal
                  Status: None
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
        Operating System: None
         Planned Release: 



In savegame2.c, sg_failure_ret() returns immediately if something bad
happens, without any attempt at cleanup.

There are a couple of memory leaks associated with this. This isn't terribly
serious, as sg_failure_ret() should never happen; if it happens then
something's gone quite badly wrong, so a memory leak is probably the least of
our worries. Still...

The worst offender is probably the one introduced by the fix for bug #17962,
which can leak an O(mapsize) chunk of memory. Other examples are much more
minor: the failures associated with the following strings can leak
string-sized chunks:
* "Failed to load specials order"
* "Failed to load bases order"

I only looked for memory leaks, and not very hard at that. There may be other
kinds of cleanup that aren't happening.

It would be nice to have an sg_failure_ret() variant which allowed a cleanup
action to be supplied, to be executed before aborting.


Reply to this item at:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to