From 2815ded21704934cb5ca1c53dc6675ecbde4c20b Mon Sep 17 00:00:00 2001 From: umanwizard Date: Tue, 9 Jul 2024 12:59:22 -0400 Subject: [PATCH] Don't set custom labels ID if we failed to save the hash (#2915) Co-authored-by: Tommy Reilly --- bpf/unwinders/native.bpf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bpf/unwinders/native.bpf.c b/bpf/unwinders/native.bpf.c index 012fc21171..b336f3d094 100644 --- a/bpf/unwinders/native.bpf.c +++ b/bpf/unwinders/native.bpf.c @@ -769,7 +769,8 @@ static __always_inline void add_stack(struct bpf_perf_event_data *ctx, u64 pid_t int err = bpf_map_update_elem(&custom_labels, &hash, lbls, BPF_ANY); if (err) LOG("[error] failed to update custom labels with %d", err); - stack_key->custom_labels_id = hash; + else + stack_key->custom_labels_id = hash; } else LOG("[error] failed to compute hash for custom labels"); } else {