From fd9f96f174ab84262561dc33e574f0b13b513e8f Mon Sep 17 00:00:00 2001 From: Jehan Date: Fri, 1 Oct 2021 12:40:10 +0200 Subject: [PATCH] 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);