Fix: Double free when calling bt_context_remove_trace()
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 21 Jan 2013 21:22:01 +0000 (16:22 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 21 Jan 2013 21:22:01 +0000 (16:22 -0500)
commitd8d1b1b164d376321bc879f6d5d1102aaf87a227
tree482d52fe2698b4d70988c751b9ffe9f1efc25a88
parentdce1d897485b9ac0d3a9a1b1c6b8490466692276
Fix: Double free when calling bt_context_remove_trace()

ctf_close_trace was being called twice when calling
bt_context_remove_trace thus causing free() to be called on an invalid
pointer.

Calling bt_context_remove_trace() would call ctf_close_trace() once via
the close_handle callback registered on the ctf format struct and a
second call would take place from bt_trace_handle_destroy() which is
registered as the value_destroy_func on the trace_handles hash table of
the current context.

bt_trace_handle_destroy() now only deallocates the trace handle and does
not perform the trace closing. This makes the
bt_trace_handle_create/destroy and bt_context_add/remove_trace parts of
the public API symmetric.

The crash is reproducible by invoking the tests-python.py script.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lib/trace-handle.c
This page took 0.024614 seconds and 4 git commands to generate.