Bug#493021: pingus: constantly leaks memory in some levels

Bas Wijnen wijnen at debian.org
Sat Jan 10 23:29:54 UTC 2009


Hi,

I've built a debugging version and used valgrind on it.  It doesn't run
at a playable speed, so I didn't play long, but I did find some memory
leaks and a variable which was used uninitialized anyway.  The attached
patch fixes them.

Valgrind still complains about some other things, but these were the
largest blocks of memory lost.

Thanks,
Bas

-- 
I encourage people to send encrypted e-mail (see http://www.gnupg.org).
If you have problems reading my e-mail, use a better reader.
Please send the central message of e-mails as plain text
   in the message body, not as HTML and definitely not as MS Word.
Please do not use the MS Word format for attachments either.
For more information, see http://a82-93-13-222.adsl.xs4all.nl/e-mail.html
-------------- next part --------------
diff -urp pingus-0.7.2_orig/src/sprite.cpp pingus-0.7.2/src/sprite.cpp
--- pingus-0.7.2_orig/src/sprite.cpp	2007-09-20 23:04:35.000000000 +0200
+++ pingus-0.7.2/src/sprite.cpp	2009-01-10 22:44:51.000000000 +0100
@@ -389,6 +389,7 @@ Sprite::make_single_user()
       new_impl->finished        = impl->finished;
       new_impl->frame           = impl->frame;
       new_impl->tick_count      = impl->tick_count;
+      new_impl->optimized	= impl->optimized;
 
       impl = new_impl;  
     }
diff -urp pingus-0.7.2_orig/src/surface.cpp pingus-0.7.2/src/surface.cpp
--- pingus-0.7.2_orig/src/surface.cpp	2007-10-30 09:20:36.000000000 +0100
+++ pingus-0.7.2/src/surface.cpp	2009-01-10 22:45:41.000000000 +0100
@@ -73,6 +73,7 @@ Surface::Surface(const Pathname& pathnam
 Surface::Surface(int width, int height, SDL_Palette* palette, int colorkey)
   : impl(new SurfaceImpl())
 {
+  impl->delete_surface = true;
   if (colorkey == -1)
     {
       impl->surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 8,
@@ -91,6 +92,7 @@ Surface::Surface(int width, int height, 
 Surface::Surface(int width, int height)
   : impl(new SurfaceImpl())
 {
+  impl->delete_surface = true;
   impl->surface = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_SRCALPHA, width, height, 32,
                                        0x000000ff,
                                        0x0000ff00,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/pkg-games-devel/attachments/20090111/6633ce77/attachment.pgp 


More information about the Pkg-games-devel mailing list