[PATCH] apitrace trim: Fix SIGSEGV in FastCallSet destructor
Lawrence L Love
lawrencex.l.love at intel.com
Fri Oct 25 03:28:37 CEST 2013
Recursive delete was looping on all items in next[] array
and stepping on already deleted objects.
Don't loop through the next[] array items. Only need to delete
next[0] in each node. Any other levels point to a next[0]
location.
Signed-off-by: Lawrence L Love <lawrencex.l.love at intel.com>
---
common/trace_fast_callset.cpp | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/common/trace_fast_callset.cpp b/common/trace_fast_callset.cpp
index d583650..d4fca54 100644
--- a/common/trace_fast_callset.cpp
+++ b/common/trace_fast_callset.cpp
@@ -139,14 +139,12 @@ void
FastCallSet::rm_node(FastCallRange * node)
{
if (node) {
- for (size_t i = 0; i < (node->level); i++) {
- rm_node (node->next[i]);
- }
+ rm_node (node->next[0]);
if (node->next) {
- delete [] node->next;
+ delete [] node->next;
+ node->next = NULL;
}
- node->next = NULL;
node->level= 0;
delete node;
node = NULL;
--
1.8.4.rc3
More information about the apitrace
mailing list