mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 10:10:32 +00:00
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:
parent
b0fa56a333
commit
6bb564968b
1 changed files with 6 additions and 1 deletions
|
@ -580,6 +580,7 @@ get_candidate_address (const gchar * candidate, gchar ** prefix,
|
||||||
gchar ** address, gchar ** postfix)
|
gchar ** address, gchar ** postfix)
|
||||||
{
|
{
|
||||||
char **tokens = NULL;
|
char **tokens = NULL;
|
||||||
|
char *tmp_address = NULL;
|
||||||
|
|
||||||
if (!g_str_has_prefix (candidate, "a=candidate:")) {
|
if (!g_str_has_prefix (candidate, "a=candidate:")) {
|
||||||
GST_ERROR ("candidate \"%s\" does not start with \"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;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tmp_address = tokens[4];
|
||||||
if (address)
|
if (address)
|
||||||
*address = g_strdup (tokens[4]);
|
*address = g_strdup (tmp_address);
|
||||||
tokens[4] = NULL;
|
tokens[4] = NULL;
|
||||||
|
|
||||||
if (prefix)
|
if (prefix)
|
||||||
*prefix = g_strjoinv (" ", tokens);
|
*prefix = g_strjoinv (" ", tokens);
|
||||||
if (postfix)
|
if (postfix)
|
||||||
*postfix = g_strdup (tokens[5]);
|
*postfix = g_strdup (tokens[5]);
|
||||||
|
|
||||||
|
tokens[4] = tmp_address;
|
||||||
|
|
||||||
g_strfreev (tokens);
|
g_strfreev (tokens);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue