mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 02:01:12 +00:00
libav: avcfg: Don't leak duplicate enumvalue entries
If we discard the duplicates, we also need to free the allocated strings. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3319>
This commit is contained in:
parent
97bfb8b6cb
commit
cadc067bde
1 changed files with 4 additions and 0 deletions
|
@ -147,6 +147,10 @@ register_enum (const AVClass ** obj, const AVOption * top_opt)
|
||||||
while (i < values->len) {
|
while (i < values->len) {
|
||||||
if (cur_val_set) {
|
if (cur_val_set) {
|
||||||
if (g_array_index (values, GEnumValue, i).value == cur_val) {
|
if (g_array_index (values, GEnumValue, i).value == cur_val) {
|
||||||
|
GEnumValue val = g_array_index (values, GEnumValue, i);
|
||||||
|
/* Don't leak the strings */
|
||||||
|
g_free ((gchar *) val.value_name);
|
||||||
|
g_free ((gchar *) val.value_nick);
|
||||||
g_array_remove_index (values, i);
|
g_array_remove_index (values, i);
|
||||||
} else {
|
} else {
|
||||||
cur_val = g_array_index (values, GEnumValue, i).value;
|
cur_val = g_array_index (values, GEnumValue, i).value;
|
||||||
|
|
Loading…
Reference in a new issue