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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3190>
This commit is contained in:
Mathieu Duponchelle 2022-10-14 18:51:43 +02:00 committed by GStreamer Marge Bot
parent b0fa56a333
commit 6bb564968b

View file

@ -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;