From 6bb564968bdfdc999bd44b25d96d87f17491aff5 Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Fri, 14 Oct 2022 18:51:43 +0200 Subject: [PATCH] webrtc/nice: fix small leak of split strings g_strfreev previously stopped at our manual NULL-termination. Fix by restoring the pointer after joining. Part-of: --- subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcice.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcice.c b/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcice.c index d2aa4ad3e4..6e60f6ed19 100644 --- a/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcice.c +++ b/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcice.c @@ -580,6 +580,7 @@ get_candidate_address (const gchar * candidate, gchar ** prefix, gchar ** address, gchar ** postfix) { char **tokens = NULL; + char *tmp_address = NULL; if (!g_str_has_prefix (candidate, "a=candidate:")) { GST_ERROR ("candidate \"%s\" does not start with \"a=candidate:\"", @@ -598,14 +599,18 @@ get_candidate_address (const gchar * candidate, gchar ** prefix, goto failure; } + tmp_address = tokens[4]; if (address) - *address = g_strdup (tokens[4]); + *address = g_strdup (tmp_address); tokens[4] = NULL; + if (prefix) *prefix = g_strjoinv (" ", tokens); if (postfix) *postfix = g_strdup (tokens[5]); + tokens[4] = tmp_address; + g_strfreev (tokens); return TRUE;