2018-10-18 07:08:10

by Peng Hao

[permalink] [raw]
Subject: [PATCH bpf-next] selftests/bpf: fix file resource leak

FILE pointer variable f is opened but never closed.

Signed-off-by:Peng Hao <[email protected]>
---
tools/testing/selftests/bpf/trace_helpers.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/bpf/trace_helpers.c b/tools/testing/selftests/bpf/trace_helpers.c
index cabe2a3..a3d1dac 100644
--- a/tools/testing/selftests/bpf/trace_helpers.c
+++ b/tools/testing/selftests/bpf/trace_helpers.c
@@ -41,6 +41,7 @@ int load_kallsyms(void)
syms[i].name = strdup(func);
i++;
}
+ fclose(f);
sym_cnt = i;
qsort(syms, sym_cnt, sizeof(struct ksym), ksym_cmp);
return 0;
--
1.8.3.1



2018-10-18 20:16:46

by Daniel Borkmann

[permalink] [raw]
Subject: Re: [PATCH bpf-next] selftests/bpf: fix file resource leak

On 10/18/2018 05:18 PM, Peng Hao wrote:
> FILE pointer variable f is opened but never closed.
>
> Signed-off-by:Peng Hao <[email protected]>

Applied to bpf-next, thanks Peng!