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/3188>
This commit is contained in:
Mathieu Duponchelle 2022-10-14 18:51:43 +02:00 committed by GStreamer Marge Bot
parent 48e097c315
commit b10e0efd3a

View file

@ -730,6 +730,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:\"",
@ -748,14 +749,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;