From cf4362adb4d49d1c35dcb9b54474310202cba497 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Wed, 2 Jul 2014 23:56:15 +0200 Subject: free strings after use --- mpd-notification.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mpd-notification.c b/mpd-notification.c index 0ea2a5c..957d8ca 100644 --- a/mpd-notification.c +++ b/mpd-notification.c @@ -115,15 +115,19 @@ int main(int argc, char ** argv) { song = mpd_recv_song(conn); if ((title = g_markup_escape_text(mpd_song_get_tag(song, MPD_TAG_TITLE, 0), -1)) == NULL) - title = TEXT_UNKNOWN; + title = strdup(TEXT_UNKNOWN); if ((artist = g_markup_escape_text(mpd_song_get_tag(song, MPD_TAG_ARTIST, 0), -1)) == NULL) - artist = TEXT_UNKNOWN; + artist = strdup(TEXT_UNKNOWN); if ((album = g_markup_escape_text(mpd_song_get_tag(song, MPD_TAG_ALBUM, 0), -1)) == NULL) - album = TEXT_UNKNOWN; + album = strdup(TEXT_UNKNOWN); notifystr = malloc(sizeof(TEXT_PLAY) + strlen(title) + strlen(artist) + strlen(album)); sprintf(notifystr, TEXT_PLAY, title, artist, album); + free(title); + free(artist); + free(album); + mpd_song_free(song); } else if (state == MPD_STATE_PAUSE) notifystr = TEXT_PAUSE; -- cgit v1.2.3-54-g00ecf