Skip to content

Commit

Permalink
Free trace_buf even though nasl_trace_fp is NULL
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ArnoStiefvater committed Jul 8, 2021
1 parent 069016a commit f43cdeb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion nasl/nasl_func.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f43cdeb

Please sign in to comment.