]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
fix memory leak
authorUkn Unknown <4031821+uknunknown@users.noreply.github.com>
Tue, 20 May 2025 01:07:18 +0000 (18:07 -0700)
committerFlole <Flole998@users.noreply.github.com>
Thu, 22 May 2025 18:04:45 +0000 (20:04 +0200)
Fixes: https://github.com/tvheadend/tvheadend/issues/1749
src/transcoding/codec/profile_audio_class.c

index 52c9219fc41e58c3cf645397155de64fc2698a72..f82a68a0b1c5f741d45d0ca18a35970581ad514d 100644 (file)
@@ -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);
                 }