URL:
  <http://gna.org/bugs/?17719>

                 Summary: Terrain sprites created by cropping not freed
                 Project: Freeciv
            Submitted by: cazfi
            Submitted on: Sun 13 Feb 2011 02:36:59 AM EET
                Category: client
                Severity: 3 - Normal
                Priority: 5 - Normal
                  Status: Ready For Test
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
                 Release: 
         Discussion Lock: Any
        Operating System: None
         Planned Release: 2.2.5, 2.3.0, 2.4.0

    _______________________________________________________

Details:

Valgrind says:

==13818== 967,680 bytes in 210 blocks are indirectly lost in loss record 663
of 680
==13818==    at 0x4C244E8: malloc (vg_replace_malloc.c:236)
==13818==    by 0x7E92F35: SDL_CreateRGBSurface (in
/usr/lib/libSDL-1.2.so.0.11.3)
==13818==    by 0x7E930C6: SDL_ConvertSurface (in
/usr/lib/libSDL-1.2.so.0.11.3)
==13818==    by 0x7E94F9C: SDL_DisplayFormatAlpha (in
/usr/lib/libSDL-1.2.so.0.11.3)
==13818==    by 0x495044: mask_surface (graphics.c:222)
==13818==    by 0x4A56AF: crop_sprite (sprite.c:108)
==13818==    by 0x44B93F: tileset_setup_tile_type (tilespec.c:3085)
==13818==    by 0x435A04: client_handle_packet (packhand_gen.c:304)
==13818==    by 0x40C09D: client_packet_input (client_main.c:566)
==13818==    by 0x411384: input_from_server (clinet.c:417)
==13818==    by 0x405E03: gui_event_loop (gui_main.c:694)
==13818==    by 0x406211: ui_main (gui_main.c:1057)
==13818==    by 0x40C529: client_main (client_main.c:509)
==13818==    by 0x83C4C4C: (below main) (libc-start.c:228)

While this raport is from running SDL-client, root problem is in client
common code and affects all clients. This is memory leak when switching
tileset or quitting program.
Most tileset sprites are put to hash by load_sprite() and everything from
hash is freed by unload_all_sprites(). These problematic sprites however are
not got directly from load_sprite(), but they are created with crop_sprite()
from one.

Fix attached



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Sun 13 Feb 2011 02:36:59 AM EET  Name: FreeCroppedTerSprites.diff 
Size: 2kB   By: cazfi

<http://gna.org/bugs/download.php?file_id=12421>
-------------------------------------------------------
Date: Sun 13 Feb 2011 02:36:59 AM EET  Name: FreeCroppedTerSprites-S2_2.diff 
Size: 2kB   By: cazfi

<http://gna.org/bugs/download.php?file_id=12422>

    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  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