changeset 34602:a5d0652dd1a0

Fix bug in freeing playlist items. If there were several items, the last item wasn't freed. Simplify code.
author ib
date Sat, 11 Feb 2012 21:17:50 +0000
parents f9b7f4b48fcb
children d0135e230f3d
files gui/util/list.c
diffstat 1 files changed, 7 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/gui/util/list.c	Sat Feb 11 21:05:34 2012 +0000
+++ b/gui/util/list.c	Sat Feb 11 21:17:50 2012 +0000
@@ -139,30 +139,16 @@
 
     // delete list
     case gtkDelPl:
-    {
-        plItem *curr = plList;
-        plItem *next;
-
-        if (!plList)
-            return NULL;
+        while (plList) {
+            plItem *next = plList->next;
 
-        if (!curr->next) {
-            free(curr->path);
-            free(curr->name);
-            free(curr);
-        } else {
-            while (curr->next) {
-                next = curr->next;
-                free(curr->path);
-                free(curr->name);
-                free(curr);
-                curr = next;
-            }
+            free(plList->path);
+            free(plList->name);
+            free(plList);
+
+            plList = next;
         }
-
-        plList    = NULL;
         plCurrent = NULL;
-    }
         return NULL;
 
     // handle url