From f43cdebd70bbb62a5916d0be3c4685e90336832b Mon Sep 17 00:00:00 2001 From: ArnoStiefvater Date: Thu, 8 Jul 2021 13:41:45 +0200 Subject: [PATCH] Free trace_buf even though nasl_trace_fp is NULL nasl_trace_fp might get set to NULL during the execution of nasl_func_call and therefore trace_buf does not get freed if we only free if nasl_trace_fp!=NULL. This is done to make static analyzer happy. --- nasl/nasl_func.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nasl/nasl_func.c b/nasl/nasl_func.c index 5cead6bf22..5f4829ae65 100644 --- a/nasl/nasl_func.c +++ b/nasl/nasl_func.c @@ -182,8 +182,11 @@ nasl_func_call (lex_ctxt *lexic, const nasl_func *f, tree_cell *arg_list) nasl_trace (lexic, "NASL> %s)\n", trace_buf); else nasl_trace (lexic, "NASL> %s ...)\n", trace_buf); - g_free (trace_buf); } + /* trace_buf freed here because nasl_trace_fp might get set to NULL during the + * execution of nasl_func_call and therefore not get freed if we only free in + * the previous if block. This is done to make static analyzer happy. */ + g_free (trace_buf); /* 4. Chain new context to old (lexic) */ lexic2->up_ctxt = lexic;