From: jeremie.galarneau@efficios.com (Jérémie Galarneau)
Subject: [lttng-dev] [RFC PATCH v2 babeltrace] Fix: Double free when calling bt_context_remove_trace().
Date: Mon, 21 Jan 2013 15:58:12 +0000 [thread overview]
Message-ID: <1358783892-30542-1-git-send-email-jeremie.galarneau@efficios.com> (raw)
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 at efficios.com>
---
lib/trace-handle.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/trace-handle.c b/lib/trace-handle.c
index 0da565b..455e440 100644
--- a/lib/trace-handle.c
+++ b/lib/trace-handle.c
@@ -49,7 +49,6 @@ struct bt_trace_handle *bt_trace_handle_create(struct bt_context *ctx)
void bt_trace_handle_destroy(struct bt_trace_handle *th)
{
- th->format->close_trace(th->td);
g_free(th);
}
--
1.8.1.1
reply other threads:[~2013-01-21 15:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1358783892-30542-1-git-send-email-jeremie.galarneau@efficios.com \
--to=jeremie.galarneau@efficios.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox