diff mbox series

libtraceeval: Fix allocation of val_stats

Message ID 20230927041901.07b756e9@rorschach.local.home (mailing list archive)
State Accepted
Headers show
Series libtraceeval: Fix allocation of val_stats | expand

Commit Message

Steven Rostedt Sept. 27, 2023, 8:19 a.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

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")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 src/histograms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ross Zwisler Oct. 2, 2023, 6:33 p.m. UTC | #1
On Wed, Sep 27, 2023 at 04:19:01AM -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
> 
> 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")
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

Reviewed-by: Ross Zwisler <zwisler@google.com>
diff mbox series

Patch

diff --git a/src/histograms.c b/src/histograms.c
index 42959c154a11..fdc9f0c2fbce 100644
--- a/src/histograms.c
+++ b/src/histograms.c
@@ -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;