From: Ukn Unknown <4031821+uknunknown@users.noreply.github.com> Date: Tue, 20 May 2025 01:07:18 +0000 (-0700) Subject: fix memory leak X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=7e1f9caa95bf8d3d3e5c3a5eb687e7acf5b9a916;p=thirdparty%2Ftvheadend.git fix memory leak Fixes: https://github.com/tvheadend/tvheadend/issues/1749 --- 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); }