[xiph-commits] r18536 - icecast/trunk/ices/src

ph3-der-loewe at svn.xiph.org ph3-der-loewe at svn.xiph.org
Sun Aug 12 16:49:47 PDT 2012


Author: ph3-der-loewe
Date: 2012-08-12 16:49:47 -0700 (Sun, 12 Aug 2012)
New Revision: 18536

Modified:
   icecast/trunk/ices/src/playlist_basic.c
Log:
fixed segfault in case playlist is empty and removed an invalid free()

Modified: icecast/trunk/ices/src/playlist_basic.c
===================================================================
--- icecast/trunk/ices/src/playlist_basic.c	2012-08-08 21:14:58 UTC (rev 18535)
+++ icecast/trunk/ices/src/playlist_basic.c	2012-08-12 23:49:47 UTC (rev 18536)
@@ -100,6 +100,13 @@
         data->pl[data->len++] = strdup(buf);
     }
 
+    if (!data->len)
+    {
+        LOG_ERROR1("Playlist file %s does not contain any track",
+                data->file);
+        return -1;
+    }
+
     if(data->random)
         shuffle(data->pl, data->len);
 
@@ -192,10 +199,7 @@
 
     while (params != NULL) {
         if (!strcmp(params->name, "file")) 
-        {
-            if (data->file) free(data->file);
             data->file = params->value;
-        } 
         else if (!strcmp(params->name, "random")) 
             data->random = atoi(params->value);
         else if(!strcmp(params->name, "once"))



More information about the commits mailing list