guri: Clear return values on error from g_uri_params_iter_next()

This reduces the chance of the caller accidentally double-freeing or
use-after-free-ing something.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall 2020-08-06 14:03:54 +01:00
parent 83597b9e57
commit ceda9755de

View File

@ -1973,6 +1973,12 @@ g_uri_params_iter_next (GUriParamsIter *iter,
g_return_val_if_fail (iter != NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
/* Pre-clear these in case of failure or finishing. */
if (attribute)
*attribute = NULL;
if (value)
*value = NULL;
if (ri->attr >= ri->end)
return FALSE;