Commit e05d5c2
selftests/bpf: close the file descriptor to avoid resource leaks
Static Analyis for bench_htab_mem.c with cppcheck:error
tools/testing/selftests/bpf/benchs/bench_htab_mem.c:284:3:
error: Resource leak: fd [resourceLeak]
tools/testing/selftests/bpf/prog_tests/sk_assign.c:41:3:
error: Resource leak: tc [resourceLeak]
fix the issue by closing the file descriptor (fd & tc) when
read & fgets operation fails.
Signed-off-by: Malaya Kumar Rout <malayarout91@gmail.com>
Acked-by: Hou Tao <houtao1@huawei.com>1 parent f11a40d commit e05d5c2
File tree
2 files changed
+4
-1
lines changed- tools/testing/selftests/bpf
- benchs
- prog_tests
2 files changed
+4
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
| 284 | + | |
284 | 285 | | |
285 | 286 | | |
286 | 287 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
| 41 | + | |
41 | 42 | | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
0 commit comments