Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
Commit fba60b17 authored by Mauricio Vásquez's avatar Mauricio Vásquez Committed by Andrii Nakryiko
Browse files

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: default avatarMauricio Vásquez <mauricio@kinvolk.io>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Acked-by: default avatarSong Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20220107152620.192327-1-mauricio@kinvolk.io
parent fe8152b3
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment