From 25c208d81d341dd940b5b672af2442c0819e6bb6 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 15 Oct 2013 21:18:55 +0200 Subject: input/*: don't allocate attribute "mime" This was a memory leak, because "mime" was a std::string which created another copy and discarded the allocated buffer. --- src/input/CdioParanoiaInputPlugin.cxx | 6 +++--- src/input/DespotifyInputPlugin.cxx | 2 +- src/input/FfmpegInputPlugin.cxx | 2 +- src/input/MmsInputPlugin.cxx | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/input/CdioParanoiaInputPlugin.cxx b/src/input/CdioParanoiaInputPlugin.cxx index 65db12760..e7fc83571 100644 --- a/src/input/CdioParanoiaInputPlugin.cxx +++ b/src/input/CdioParanoiaInputPlugin.cxx @@ -240,9 +240,9 @@ input_cdio_open(const char *uri, i->base.size = (i->lsn_to - i->lsn_from + 1) * CDIO_CD_FRAMESIZE_RAW; /* hack to make MPD select the "pcm" decoder plugin */ - i->base.mime = g_strdup(reverse_endian - ? "audio/x-mpd-cdda-pcm-reverse" - : "audio/x-mpd-cdda-pcm"); + i->base.mime = reverse_endian + ? "audio/x-mpd-cdda-pcm-reverse" + : "audio/x-mpd-cdda-pcm"; return &i->base; } diff --git a/src/input/DespotifyInputPlugin.cxx b/src/input/DespotifyInputPlugin.cxx index b0665e659..27c54160c 100644 --- a/src/input/DespotifyInputPlugin.cxx +++ b/src/input/DespotifyInputPlugin.cxx @@ -60,7 +60,7 @@ struct DespotifyInputStream { memset(&pcm, 0, sizeof(pcm)); /* Despotify outputs pcm data */ - base.mime = g_strdup("audio/x-mpd-cdda-pcm"); + base.mime = "audio/x-mpd-cdda-pcm"; base.ready = true; } diff --git a/src/input/FfmpegInputPlugin.cxx b/src/input/FfmpegInputPlugin.cxx index f8b948c43..60562062d 100644 --- a/src/input/FfmpegInputPlugin.cxx +++ b/src/input/FfmpegInputPlugin.cxx @@ -53,7 +53,7 @@ struct FfmpegInputStream { - since avio.h doesn't tell us the MIME type of the resource, we can't select a decoder plugin, but the "ffmpeg" plugin is quite good at auto-detection */ - base.mime = g_strdup("audio/x-mpd-ffmpeg"); + base.mime = "audio/x-mpd-ffmpeg"; } ~FfmpegInputStream() { diff --git a/src/input/MmsInputPlugin.cxx b/src/input/MmsInputPlugin.cxx index 15c6ac377..069857fba 100644 --- a/src/input/MmsInputPlugin.cxx +++ b/src/input/MmsInputPlugin.cxx @@ -45,7 +45,7 @@ struct MmsInputStream { mms(_mms), eof(false) { /* XX is this correct? at least this selects the ffmpeg decoder, which seems to work fine*/ - base.mime = g_strdup("audio/x-ms-wma"); + base.mime = "audio/x-ms-wma"; base.ready = true; } -- cgit v1.2.3