Skip to contentSkip to conversation

libtraceeval: Fix allocation of val_stats

PATCH In review Steven Rostedt 2 participants 2 messages Sep 27, 2023 – Oct 2, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libtraceeval: Fix allocation of val_stats

From: "Steven Rostedt (Google)" <[email protected]>

The val_stats is to be the same size as the number of val types. But the number of key times was used to create the size.

Fixes 8df588c6bc128 ("libtraceeval histogram: Add updating of stats")
---
 src/histograms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/histograms.c +1 -1
index 42959c154a11..fdc9f0c2fbce 100644
@@ -740,7 +740,7 @@ static int create_entry(struct traceeval *teval,
 	if (!entry)
 		return -1;
 
-	entry->val_stats = calloc(teval->nr_key_types, sizeof(*entry->val_stats));
+	entry->val_stats = calloc(teval->nr_val_types, sizeof(*entry->val_stats));
 	if (!entry->val_stats)
 		goto fail_entry;
 
Signature · 1 line
2.40.1