From cadc067bde7531e48c2144fa31c5e644c92097f4 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Fri, 4 Nov 2022 07:59:10 +0100 Subject: [PATCH] libav: avcfg: Don't leak duplicate enumvalue entries If we discard the duplicates, we also need to free the allocated strings. Part-of: --- subprojects/gst-libav/ext/libav/gstavcfg.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subprojects/gst-libav/ext/libav/gstavcfg.c b/subprojects/gst-libav/ext/libav/gstavcfg.c index a8635a740c..afa91854c5 100644 --- a/subprojects/gst-libav/ext/libav/gstavcfg.c +++ b/subprojects/gst-libav/ext/libav/gstavcfg.c @@ -147,6 +147,10 @@ register_enum (const AVClass ** obj, const AVOption * top_opt) while (i < values->len) { if (cur_val_set) { 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); } else { cur_val = g_array_index (values, GEnumValue, i).value;