[gimp] app: get rid of a wrong return-after-free report.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: get rid of a wrong return-after-free report.
- Date: Fri, 1 Oct 2021 10:52:17 +0000 (UTC)
commit fd9f96f174ab84262561dc33e574f0b13b513e8f
Author: Jehan <jehan girinstud io>
Date: Fri Oct 1 12:40:10 2021 +0200
app: get rid of a wrong return-after-free report.
Reported by Massimo, though this one is wrong, as far as I can see.
`ninja scan-build` apparently reports `result` as being returned after
being freed here. But actually since we are setting the `error` with
g_set_error() in the same time we free `result`, we would also enter the
`if (*error)` block a few lines later, which would return NULL and not
`result` anyway. I guess the static analyzer could not see that far.
Still, set the pointer to NULL with g_clear_pointer(), which should be
enough to make the static analyzer happy.
app/propgui/gimppropgui-eval.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/app/propgui/gimppropgui-eval.c b/app/propgui/gimppropgui-eval.c
index 548bc1adc8..6951d51ea4 100644
--- a/app/propgui/gimppropgui-eval.c
+++ b/app/propgui/gimppropgui-eval.c
@@ -655,7 +655,7 @@ gimp_prop_eval_string_impl (GObject *config,
g_set_error (error, GIMP_PROP_EVAL_ERROR, GIMP_PROP_EVAL_FAILED,
"invalid expression");
- g_free (result);
+ g_clear_pointer (&result, g_free);
}
g_free (t);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]