diff --git a/tools/lib/bpf/usdt.c b/tools/lib/bpf/usdt.c index c5acf2824fcc4d9e49ffd8df1575ff7ca9865965..bb1e88613343c6683cb9528f625a3103fb0e5590 100644 --- a/tools/lib/bpf/usdt.c +++ b/tools/lib/bpf/usdt.c @@ -1071,8 +1071,8 @@ struct bpf_link *usdt_manager_attach_usdt(struct usdt_manager *man, const struct return &link->link; err_out: - bpf_link__destroy(&link->link); - + if (link) + bpf_link__destroy(&link->link); free(targets); hashmap__free(specs_hash); if (elf)