From: mathieu.desnoyers@efficios.com (Mathieu Desnoyers)
Subject: [ltt-dev] [BABELTRACE PATCH] Free the callbacks on iter_destroy
Date: Tue, 13 Sep 2011 17:12:34 -0400 [thread overview]
Message-ID: <20110913211234.GA21109@Krystal> (raw)
In-Reply-To: <1315945985-29058-1-git-send-email-julien.desfossez@polymtl.ca>
* Julien Desfossez (julien.desfossez at polymtl.ca) wrote:
> Signed-off-by: Julien Desfossez <julien.desfossez at polymtl.ca>
[ edit : use TRUE instead of 1 ]
merged, thanks!
MAthieu
> ---
> converter/babeltrace-lib.c | 23 +++++++++++++++++++++++
> 1 files changed, 23 insertions(+), 0 deletions(-)
>
> diff --git a/converter/babeltrace-lib.c b/converter/babeltrace-lib.c
> index 176eff3..3e17bf9 100644
> --- a/converter/babeltrace-lib.c
> +++ b/converter/babeltrace-lib.c
> @@ -406,8 +406,31 @@ error_malloc:
>
> void babeltrace_iter_destroy(struct babeltrace_iter *iter)
> {
> + struct bt_stream_callbacks *bt_stream_cb;
> + struct bt_callback_chain *bt_chain;
> + int i, j;
> +
> heap_free(iter->stream_heap);
> g_free(iter->stream_heap);
> +
> + /* free all events callbacks */
> + if (iter->main_callbacks.callback)
> + g_array_free(iter->main_callbacks.callback, 1);
> +
> + /* free per-event callbacks */
> + for (i = 0; i < iter->callbacks->len; i++) {
> + bt_stream_cb = &g_array_index(iter->callbacks,
> + struct bt_stream_callbacks, i);
> + if (!bt_stream_cb || !bt_stream_cb->per_id_callbacks)
> + continue;
> + for (j = 0; j < bt_stream_cb->per_id_callbacks->len; j++) {
> + bt_chain = &g_array_index(bt_stream_cb->per_id_callbacks,
> + struct bt_callback_chain, j);
> + g_array_free(bt_chain->callback, 1);
> + }
> + g_array_free(bt_stream_cb->per_id_callbacks, 1);
> + }
> +
> free(iter);
> }
>
> --
> 1.7.5.4
>
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
prev parent reply other threads:[~2011-09-13 21:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-13 20:33 Julien Desfossez
2011-09-13 21:12 ` Mathieu Desnoyers [this message]
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=20110913211234.GA21109@Krystal \
--to=mathieu.desnoyers@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