changeset 32921:448517f556a5

Fix memory leak in appClearItem(). Mask wasn't freed. Additionally: symbolic constants are used for initialization where possible, the pressed default is btnDisabled now, gfree() is preferred to free() and setting NULL, and statements are rearranged according to members in structure.
author ib
date Thu, 03 Mar 2011 11:43:01 +0000
parents 8661ae44ef39
children 4546e629ae70
files gui/app.c
diffstat 1 files changed, 18 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/gui/app.c	Thu Mar 03 11:06:42 2011 +0000
+++ b/gui/app.c	Thu Mar 03 11:43:01 2011 +0000
@@ -21,6 +21,9 @@
 
 #include "app.h"
 
+#include "gui/skin/font.h"
+#include "interface.h"
+
 listItems appMPlayer;
 
 static const evName evNames[] = {
@@ -78,25 +81,30 @@
 
 static void appClearItem(wItem *item)
 {
-    item->type    = 0;
+    item->type   = itNone;
     item->x       = 0;
     item->y       = 0;
     item->width   = 0;
     item->height  = 0;
-    item->pwidth  = 0;
-    item->pheight = 0;
-    item->message = 0;
-    item->pressed = btnReleased;
-    item->tmp     = 0;
     bpFree(&item->Bitmap);
+    bpFree(&item->Mask);
     item->fontid = 0;
-    free(item->label);
-    item->label = NULL;
-    free(item->text);
-    item->text      = NULL;
+    item->align  = fntAlignLeft;
+    gfree((void **)&item->label);
+    item->pwidth    = 0;
+    item->pheight   = 0;
+    item->numphases = 0;
+    item->value     = 0;
+    item->message   = evNone;
+    item->R = 0;
+    item->G = 0;
+    item->B = 0;
+    gfree((void **)&item->text);
     item->textwidth = 0;
     item->starttime = 0;
     item->last_x    = 0;
+    item->pressed   = btnDisabled;
+    item->tmp       = 0;
 }
 
 void appInitStruct(listItems *item)