From 04bf8a6b1ae7427199e0e38e6068185f9965f653 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 20 Oct 2021 10:16:10 +0200 Subject: [PATCH] output/pipewire: fix memory leak in SendTag() --- src/output/plugins/PipeWireOutputPlugin.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/output/plugins/PipeWireOutputPlugin.cxx b/src/output/plugins/PipeWireOutputPlugin.cxx index 316ce98aa..a21a6a912 100644 --- a/src/output/plugins/PipeWireOutputPlugin.cxx +++ b/src/output/plugins/PipeWireOutputPlugin.cxx @@ -666,7 +666,9 @@ PipeWireOutput::SendTag(const Tag &tag) const char *artist, *title; - const char *medianame = FormatTag(tag, "%artist% - %title%"); + char *medianame = FormatTag(tag, "%artist% - %title%"); + AtScopeExit(medianame) { free(medianame); }; + items[n_items++] = SPA_DICT_ITEM_INIT(PW_KEY_MEDIA_NAME, medianame); artist = tag.GetValue(TAG_ARTIST);