Skip to content

Commit 7e1f9ca

Browse files
uknunknownFlole998
authored andcommitted
fix memory leak
Fixes: #1749
1 parent ebac087 commit 7e1f9ca

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

src/transcoding/codec/profile_audio_class.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,14 @@ tvh_codec_audio_get_list_channel_layouts(TVHAudioCodec *self)
107107
l = channel_layouts;
108108
ADD_ENTRY(list, map, s64, 0, str, AUTO_STR);
109109
while (l->nb_channels != 0) {
110-
if (!(map = htsmsg_create_map())) {
111-
htsmsg_destroy(list);
112-
list = NULL;
113-
break;
114-
}
115-
l_buf[0] = '\0';
116-
if(av_channel_layout_describe(l, l_buf, sizeof(l_buf)) > 0)
110+
if(av_channel_layout_describe(l, l_buf, sizeof(l_buf)) > 0) {
111+
if (!(map = htsmsg_create_map())) {
112+
htsmsg_destroy(list);
113+
list = NULL;
114+
break;
115+
}
117116
ADD_ENTRY(list, map, s64, l->u.mask, str, l_buf);
117+
}
118118
l++;
119119
}
120120
#else
@@ -126,7 +126,6 @@ tvh_codec_audio_get_list_channel_layouts(TVHAudioCodec *self)
126126
list = NULL;
127127
break;
128128
}
129-
l_buf[0] = '\0';
130129
av_get_channel_layout_string(l_buf, sizeof(l_buf), 0, l);
131130
ADD_ENTRY(list, map, s64, l, str, l_buf);
132131
}

0 commit comments

Comments
 (0)