Fix: trace_collection_add() add after check
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 4 Apr 2013 16:53:14 +0000 (12:53 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 4 Apr 2013 16:53:14 +0000 (12:53 -0400)
Fix segmentation fault by adding trace into trace collection only after
check for time correlation has succeeded.

Reported-by: Etienne Bergeron <etienneb@google.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lib/trace-collection.c

index 608a6e458093f7f751a0807112f1c0b7ffa98c00..c5c875c975d64d4d76bd83822a12034218e0e528 100644 (file)
@@ -164,8 +164,6 @@ int bt_trace_collection_add(struct trace_collection *tc,
                return -EINVAL;
 
        trace = container_of(td, struct ctf_trace, parent);
-       g_ptr_array_add(tc->array, td);
-       trace->collection = tc;
 
        if (tc->array->len > 1) {
                struct clock_match clock_match = {
@@ -187,6 +185,9 @@ int bt_trace_collection_add(struct trace_collection *tc,
                }
        }
 
+       g_ptr_array_add(tc->array, td);
+       trace->collection = tc;
+
        {
                struct clock_match clock_match = {
                        .clocks = tc->clocks,
This page took 0.024603 seconds and 4 git commands to generate.