cedric pushed a commit to branch master.

commit 738042a18a114038d1f86ef5a20791137a1ad12b
Author: Jean GUYOMARC'H <[email protected]>
Date:   Fri Aug 9 10:57:15 2013 +0900

    elemines: fix some memory leak.
---
 src/gui.c  |  6 +++---
 src/main.c | 14 ++++++++++++++
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/gui.c b/src/gui.c
index d4b6da5..e16de83 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -30,7 +30,7 @@
 
 static double pause_time = 0;
 
-void
+static void
 _quit(void *data __UNUSED__, Evas_Object *obj __UNUSED__,
       void *event_info __UNUSED__)
 {
@@ -181,7 +181,7 @@ _pause_del(void *data __UNUSED__, Evas *e __UNUSED__, 
Evas_Object *obj,
    evas_object_hide(obj);
 }
 
-void
+static void
 _pause(void *data __UNUSED__, Evas_Object *obj __UNUSED__,
        void *event_info __UNUSED__)
 {
@@ -213,7 +213,7 @@ gui(char *theme, Eina_Bool fullscreen)
 {
    Evas_Object *background, *vbox, *toolbar, *hbox, *conform;
    int x, y;
-   char *str1, *str2;
+   char *str1, *str2 = NULL;
 
    /* get the edje theme file */
    snprintf(game.edje_file, sizeof(game.edje_file), "%s/themes/%s.edj",
diff --git a/src/main.c b/src/main.c
index d73200f..4c7fa87 100644
--- a/src/main.c
+++ b/src/main.c
@@ -138,6 +138,19 @@ _debug(void)
    printf("\n");
 }
 
+static void
+_shutdown(void)
+{
+   int i;
+
+   if (matrix)
+     {
+        for (i = 0; i < game.datas.x_theme + 2; i++)
+          free(matrix[i]);
+        free(matrix);
+     }
+}
+
 static const Ecore_Getopt optdesc = {
   "elemines",
   "%prog [options]",
@@ -212,6 +225,7 @@ elm_main(int argc __UNUSED__, char **argv __UNUSED__)
    elm_run();
 
  end:
+   _shutdown();
    elm_shutdown();
 
    return 0;

-- 

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk

Reply via email to