selftest/bpf : file resource leak
diff mbox series

Message ID 1539783685-5549-1-git-send-email-penghao122@sina.com.cn
State New
Headers show
Series
  • selftest/bpf : file resource leak
Related show

Commit Message

Peng Hao Oct. 17, 2018, 1:41 p.m. UTC
From: Peng Hao <peng.hao2@zte.com.cn>

FILE pointer variable f is opened but never closed.

Signed-off-by: Peng Hao <peng.hao2@zte.com.cn>
---
 tools/testing/selftests/bpf/trace_helpers.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Alexei Starovoitov Oct. 18, 2018, 4:51 a.m. UTC | #1
On Wed, Oct 17, 2018 at 09:41:25AM -0400, Peng Hao wrote:
> 
> From: Peng Hao <peng.hao2@zte.com.cn>
> 
> FILE pointer variable f is opened but never closed.
> 
> Signed-off-by: Peng Hao <peng.hao2@zte.com.cn>
> ---
>  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);

looks good.
please resubmit cc-ing netdev, so it gets into patchwork and we can apply it properly.
Please change subj to [PATCH bpf-next] and add a Fixes tag.
Thanks!

Patch
diff mbox series

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;