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

ph3-der-loewe at svn.xiph.org ph3-der-loewe at svn.xiph.org
Mon Feb 13 15:02:29 PST 2012


Author: ph3-der-loewe
Date: 2012-02-13 15:02:29 -0800 (Mon, 13 Feb 2012)
New Revision: 18196

Modified:
   icecast/trunk/ices/src/playlist_basic.c
Log:
Use strdup() not malloc() + strlen() + strcpy() (Closes: #1795)

Modified: icecast/trunk/ices/src/playlist_basic.c
===================================================================
--- icecast/trunk/ices/src/playlist_basic.c	2012-02-11 02:22:09 UTC (rev 18195)
+++ icecast/trunk/ices/src/playlist_basic.c	2012-02-13 23:02:29 UTC (rev 18196)
@@ -125,7 +125,7 @@
 char *playlist_basic_get_next_filename(void *data)
 {
     basic_playlist *pl = (basic_playlist *)data;
-    char *ptr = NULL, *dest = NULL;
+    char *ptr = NULL;
     int reload_playlist = 0;
     struct stat st;
 
@@ -171,10 +171,7 @@
 
     ptr = pl->pl [pl->pos++];
 
-    if ((dest = malloc (strlen (ptr)+1)) == NULL)
-        return NULL;
-    strcpy (dest, ptr);
-    return dest;
+    return strdup(ptr);
 }
 
 void playlist_basic_free_filename(void *data, char *fn)



More information about the commits mailing list