From 7e1f9caa95bf8d3d3e5c3a5eb687e7acf5b9a916 Mon Sep 17 00:00:00 2001 From: Ukn Unknown <4031821+uknunknown@users.noreply.github.com> Date: Mon, 19 May 2025 18:07:18 -0700 Subject: [PATCH] fix memory leak Fixes: https://github.com/tvheadend/tvheadend/issues/1749 --- src/transcoding/codec/profile_audio_class.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/transcoding/codec/profile_audio_class.c b/src/transcoding/codec/profile_audio_class.c index 52c9219fc..f82a68a0b 100644 --- a/src/transcoding/codec/profile_audio_class.c +++ b/src/transcoding/codec/profile_audio_class.c @@ -107,14 +107,14 @@ tvh_codec_audio_get_list_channel_layouts(TVHAudioCodec *self) l = channel_layouts; ADD_ENTRY(list, map, s64, 0, str, AUTO_STR); while (l->nb_channels != 0) { - if (!(map = htsmsg_create_map())) { - htsmsg_destroy(list); - list = NULL; - break; - } - l_buf[0] = '\0'; - if(av_channel_layout_describe(l, l_buf, sizeof(l_buf)) > 0) + if(av_channel_layout_describe(l, l_buf, sizeof(l_buf)) > 0) { + if (!(map = htsmsg_create_map())) { + htsmsg_destroy(list); + list = NULL; + break; + } ADD_ENTRY(list, map, s64, l->u.mask, str, l_buf); + } l++; } #else @@ -126,7 +126,6 @@ tvh_codec_audio_get_list_channel_layouts(TVHAudioCodec *self) list = NULL; break; } - l_buf[0] = '\0'; av_get_channel_layout_string(l_buf, sizeof(l_buf), 0, l); ADD_ENTRY(list, map, s64, l, str, l_buf); } -- 2.47.3