[MPlayer-cvslog] r34690 - trunk/gui/util/list.c

ib subversion at mplayerhq.hu
Sat Feb 11 22:17:51 CET 2012


Author: ib
Date: Sat Feb 11 22:17:50 2012
New Revision: 34690

Log:
Fix bug in freeing playlist items.

If there were several items, the last item wasn't freed.

Simplify code.

Modified:
   trunk/gui/util/list.c

Modified: trunk/gui/util/list.c
==============================================================================
--- trunk/gui/util/list.c	Sat Feb 11 22:05:34 2012	(r34689)
+++ trunk/gui/util/list.c	Sat Feb 11 22:17:50 2012	(r34690)
@@ -139,30 +139,16 @@ void *listSet(int cmd, void *vparam)
 
     // delete list
     case gtkDelPl:
-    {
-        plItem *curr = plList;
-        plItem *next;
+        while (plList) {
+            plItem *next = plList->next;
 
-        if (!plList)
-            return NULL;
+            free(plList->path);
+            free(plList->name);
+            free(plList);
 
-        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;
-            }
+            plList = next;
         }
-
-        plList    = NULL;
         plCurrent = NULL;
-    }
         return NULL;
 
     // handle url


More information about the MPlayer-cvslog mailing list