selftests/bpf: fix file resource leak in load_kallsyms
authorPeng Hao <peng.hao2@zte.com.cn>
Thu, 18 Oct 2018 15:18:36 +0000 (23:18 +0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 18 Oct 2018 20:13:30 +0000 (22:13 +0200)
FILE pointer variable f is opened but never closed.

Signed-off-by: Peng Hao <peng.hao2@zte.com.cn>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/testing/selftests/bpf/trace_helpers.c

index cabe2a3..a3d1dac 100644 (file)
@@ -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;