bugFreeciv - Bugs: bug #18347, Minor memory leaks due to...

Show feedback again

bug #18347: Minor memory leaks due to sg_failure_ret()

Submitted by:  Jacob Nevins <jtn>
Submitted on:  Thu Jul 14 00:00:00 2011  
Category: generalSeverity: 2 - Minor
Priority: 5 - NormalStatus: None
Assigned to: NoneOpen/Closed: Open
Release: Operating System: None
Planned Release: Contains string changes: None

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


Thu Jul 14 00:00:00 2011, original submission:

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.

Jacob Nevins <jtn>
Project Administrator


(Note: upload size limit is set to 1024 kB, after insertion of the required escape characters.)

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by jtn (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Error: not logged in



    No Changes Have Been Made to This Item
    Show feedback again

    Back to the top

    Powered by Savane 3.1-cleanup