[five-or-more] Fixed various possible memory leaks.



commit 294bd9e95a9219d8c3730600d35a79764495760f
Author: Robert Roth <robert roth off gmail com>
Date:   Sat Jan 10 08:36:34 2015 +0200

    Fixed various possible memory leaks.
    
    * Made some global variables local-only
    * Free objects as soon as possible
    * Make sure cleanup is called both on quit and close

 src/five-or-more.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/src/five-or-more.c b/src/five-or-more.c
index 61b400a..63e964a 100644
--- a/src/five-or-more.c
+++ b/src/five-or-more.c
@@ -1461,14 +1461,11 @@ static void cleanup ()
 {
   int i = 0;
 
-  for (i = 0; i < G_N_ELEMENTS(preview_images); i++)
+  for (i = 0; i < G_N_ELEMENTS (preview_images); i++)
     if (preview_pixbufs[i])
       g_object_unref (preview_pixbufs[i]);
 
-  if (ball_preimage) {
-    g_object_unref (ball_preimage);
-    ball_preimage = NULL;
-  }
+  g_clear_object (&ball_preimage);
   g_object_unref (highscores);
 
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]