mapper: fix memory leak when playlist_directory is not set

Don't allocate the file name before the playlist_dir==NULL check.
This commit is contained in:
Max Kellermann
2009-12-08 08:06:10 +01:00
parent 7162fe85ce
commit 23e46b38ca
2 changed files with 3 additions and 2 deletions

View File

@@ -221,12 +221,12 @@ map_spl_path(void)
char *
map_spl_utf8_to_fs(const char *name)
{
char *filename = g_strconcat(name, PLAYLIST_FILE_SUFFIX, NULL);
char *path;
char *filename, *path;
if (playlist_dir == NULL)
return NULL;
filename = g_strconcat(name, PLAYLIST_FILE_SUFFIX, NULL);
path = g_build_filename(playlist_dir, filename, NULL);
g_free(filename);