btf_loader: Plug leak when bailing out due to unknown tag
Fixes this coverity report:
Error: RESOURCE_LEAK (CWE-772): [#def2]
dwarves-1.13/btf_loader.c:342: alloc_fn: Storage is returned from allocation function "zalloc".
dwarves-1.13/btf_loader.c:342: var_assign: Assigning: "tag" = storage returned from "zalloc(40UL)".
dwarves-1.13/btf_loader.c:354: leaked_storage: Variable "tag" going out of scope leaks the storage it points to.
# 352| default:
# 353| printf("%s: FOO %d\n\n", __func__, type);
# 354|-> return 0;
# 355| }
# 356|
Reported-by: William Cohen <wcohen@redhat.com>
Fixes: 472256d3c57b ("btf_loader: Introduce a loader for the BTF format")
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 file changed