diff options
author | Mauricio Vásquez <mauricio@kinvolk.io> | 2022-01-07 18:26:19 +0300 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2022-01-13 04:01:36 +0300 |
commit | fba60b171a0322830b446dd28170092c47243d39 (patch) | |
tree | 02b727a151b345636d95b4c39a83947cd9d123db /tools/bpf/bpftool/btf.c | |
parent | fe8152b38d3a994c4c6fdbc0cd6551d569a5715a (diff) | |
download | linux-fba60b171a0322830b446dd28170092c47243d39.tar.xz |
libbpf: Use IS_ERR_OR_NULL() in hashmap__free()
hashmap__new() uses ERR_PTR() to return an error so it's better to
use IS_ERR_OR_NULL() in order to check the pointer before calling
free(). This will prevent freeing an invalid pointer if somebody calls
hashmap__free() with the result of a failed hashmap__new() call.
Signed-off-by: Mauricio Vásquez <mauricio@kinvolk.io>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20220107152620.192327-1-mauricio@kinvolk.io
Diffstat (limited to 'tools/bpf/bpftool/btf.c')
0 files changed, 0 insertions, 0 deletions