Commit f6689737 authored by Philipp Schafft's avatar Philipp Schafft 🦁

fixed segfault in case playlist is empty and removed an invalid free()

svn path=/icecast/trunk/ices/; revision=18536
parent 75c9dabc
......@@ -100,6 +100,13 @@ static int load_playlist(basic_playlist *data)
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 @@ int playlist_basic_initialise(module_param_t *params, playlist_state_t *pl)
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"))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment