summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2014-07-02 23:56:15 +0200
committerGravatar Christian Hesse <mail@eworm.de>2014-07-02 23:56:15 +0200
commitcf4362adb4d49d1c35dcb9b54474310202cba497 (patch)
tree1000cb2b7b9cf84f8f6c7cbdb797d51a852cd39f
parent491519cf8478eda197622fe8aa6133543db683de (diff)
downloadmpd-notification-cf4362adb4d49d1c35dcb9b54474310202cba497.tar.gz
mpd-notification-cf4362adb4d49d1c35dcb9b54474310202cba497.tar.zst
free strings after use
-rw-r--r--mpd-notification.c10
1 files 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;