On Thu, Sep 12, 2024 at 1:58 AM zhangjiao2 <zhangjiao2@xxxxxxxxxxxxxxxxxxxx> wrote: > > From: zhang jiao <zhangjiao2@xxxxxxxxxxxxxxxxxxxx> > > Cppcheck find a error as below: > bpf_dbg.c:1397:2: error: Resource leak: fin [resourceLeak] > Add fclose to rm this error. > > Signed-off-by: zhang jiao <zhangjiao2@xxxxxxxxxxxxxxxxxxxx> > --- > tools/bpf/bpf_dbg.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/tools/bpf/bpf_dbg.c b/tools/bpf/bpf_dbg.c > index 00e560a17baf..5fb17fa0ace8 100644 > --- a/tools/bpf/bpf_dbg.c > +++ b/tools/bpf/bpf_dbg.c > @@ -1394,5 +1394,11 @@ int main(int argc, char **argv) > if (argc >= 3) > fout = fopen(argv[2], "w"); > > - return run_shell_loop(fin ? : stdin, fout ? : stdout); > + run_shell_loop(fin ? : stdin, fout ? : stdout); > + > + if (fin) > + fclose(fin); > + if (fout) > + fclose(fout); > + return 0; main() is about to exit. There is really no need to close it explicitly. pw-bot: cr Daniel, is this debugger still useful? Should we remove it? and bpf_jit_disasm.c too ?