[glib: 9/15] guri: Clear return values on error from g_uri_params_iter_next()
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 9/15] guri: Clear return values on error from g_uri_params_iter_next()
- Date: Fri, 7 Aug 2020 14:14:30 +0000 (UTC)
commit ceda9755dea78a74422aac06fdf3d83ea151dd46
Author: Philip Withnall <withnall endlessm com>
Date: Thu Aug 6 14:03:54 2020 +0100
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>
glib/guri.c | 6 ++++++
1 file changed, 6 insertions(+)
---
diff --git a/glib/guri.c b/glib/guri.c
index f0944a050..905130255 100644
--- a/glib/guri.c
+++ b/glib/guri.c
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]