From 6fc1049e6379c72166b6e63d4ba1e6d6de4777b1 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Tue, 6 Jun 2023 17:33:42 -0700 Subject: [PATCH] libsysprof-analyze: don't duplicate callers --- src/libsysprof-analyze/sysprof-callgraph.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libsysprof-analyze/sysprof-callgraph.c b/src/libsysprof-analyze/sysprof-callgraph.c index bf3af842..56d5c8a0 100644 --- a/src/libsysprof-analyze/sysprof-callgraph.c +++ b/src/libsysprof-analyze/sysprof-callgraph.c @@ -166,6 +166,7 @@ sysprof_callgraph_populate_callers (SysprofCallgraph *self, iter = iter->parent) { GPtrArray *callers; + guint pos; if (!(callers = g_hash_table_lookup (hash, iter->symbol))) { @@ -175,7 +176,8 @@ sysprof_callgraph_populate_callers (SysprofCallgraph *self, g_assert (iter->parent->symbol != NULL); - g_ptr_array_add (callers, iter->parent->symbol); + if (!g_ptr_array_find (callers, iter->parent->symbol, &pos)) + g_ptr_array_add (callers, iter->parent->symbol); } }