Code

screen_browser: convert path only for the message
authorMax Kellermann <max@duempel.org>
Sat, 17 Oct 2009 22:30:42 +0000 (00:30 +0200)
committerMax Kellermann <max@duempel.org>
Sat, 17 Oct 2009 22:30:42 +0000 (00:30 +0200)
We don't need the locale path if we don't print a message.

src/screen_browser.c

index 455053c60a5bcab4e294079642818a01faa74ca1..8802e5f93bb1eab29ed8d8ace445048a8fea495f 100644 (file)
@@ -122,16 +122,17 @@ static bool
 load_playlist(struct mpdclient *c, const struct mpd_playlist *playlist)
 {
        struct mpd_connection *connection = mpdclient_get_connection(c);
-       char *filename = utf8_to_locale(mpd_playlist_get_path(playlist));
 
        if (mpd_run_load(connection, mpd_playlist_get_path(playlist))) {
+               char *filename = utf8_to_locale(mpd_playlist_get_path(playlist));
                screen_status_printf(_("Loading playlist %s..."),
                                     g_basename(filename));
+               g_free(filename);
+
                c->events |= MPD_IDLE_QUEUE;
        } else
                mpdclient_handle_error(c);
 
-       g_free(filename);
        return true;
 }