src/playlist.c: remove unnecessary strdup()
Yes, I know about what I said on IRC earlier, but this is an allocation + free inside a loop. git-svn-id: https://svn.musicpd.org/mpd/trunk@3953 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
@@ -1461,12 +1461,13 @@ static int PlaylistIterFunc(FILE * fp, char * utf8file, void (*IterFunc)(FILE *f
|
|||||||
slength = 0;
|
slength = 0;
|
||||||
temp = fsCharsetToUtf8(s);
|
temp = fsCharsetToUtf8(s);
|
||||||
if(!temp) continue;
|
if(!temp) continue;
|
||||||
/* Needed to make a copy? */
|
|
||||||
if(!commentCharFound)
|
if(!commentCharFound)
|
||||||
{
|
{
|
||||||
temp = strdup(temp);
|
/* using temp directly should be safe,
|
||||||
IterFunc(fp, temp, &erroredFile);
|
* for our current IterFunction set
|
||||||
free(temp);
|
* but just in case, we copy to s */
|
||||||
|
strcpy(s, temp);
|
||||||
|
IterFunc(fp, s, &erroredFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(slength==MAXPATHLEN) {
|
else if(slength==MAXPATHLEN) {
|
||||||
|
Reference in New Issue
Block a user