From: mathieu.desnoyers@efficios.com (Mathieu Desnoyers)
Subject: [lttng-dev] [PATCH babeltrace-1.5 4/6] Fix: lib/iterator.c: unbalanced ctx put (leak)
Date: Thu, 5 Dec 2019 01:58:07 -0500 [thread overview]
Message-ID: <20191205065809.16728-5-mathieu.desnoyers@efficios.com> (raw)
In-Reply-To: <20191205065809.16728-1-mathieu.desnoyers@efficios.com>
Missing context put in iterator init error path.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
lib/iterator.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/iterator.c b/lib/iterator.c
index 639a2d29..77093217 100644
--- a/lib/iterator.c
+++ b/lib/iterator.c
@@ -778,6 +778,8 @@ int bt_iter_init(struct bt_iter *iter,
error:
bt_heap_free(iter->stream_heap);
error_heap_init:
+ bt_context_put(ctx);
+ iter->ctx = NULL;
g_free(iter->stream_heap);
iter->stream_heap = NULL;
error_ctx:
@@ -812,6 +814,7 @@ void bt_iter_fini(struct bt_iter *iter)
}
iter->ctx->current_iterator = NULL;
bt_context_put(iter->ctx);
+ iter->ctx = NULL;
}
void bt_iter_destroy(struct bt_iter *iter)
--
2.17.1
next prev parent reply other threads:[~2019-12-05 6:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-05 6:58 [lttng-dev] [PATCH babeltrace-1.5 0/6] Babeltrace 1.5 lttng-live with per-pid ust buffers Mathieu Desnoyers
2019-12-05 6:58 ` [lttng-dev] [PATCH babeltrace-1.5 1/6] Fix: lttng-live: use-after-free in get_next_index() Mathieu Desnoyers
2019-12-05 6:58 ` [lttng-dev] [PATCH babeltrace-1.5 2/6] Fix: trace-collection: trace clock use after free Mathieu Desnoyers
2019-12-05 6:58 ` [lttng-dev] [PATCH babeltrace-1.5 3/6] Fix: lttng-live: lttng_live_open_trace_read memory leak Mathieu Desnoyers
2019-12-05 6:58 ` Mathieu Desnoyers [this message]
2019-12-05 6:58 ` [lttng-dev] [PATCH babeltrace-1.5 5/6] Fix: lttng-live: ctf_live_packet_seek stream hang up handling Mathieu Desnoyers
2019-12-05 6:58 ` [lttng-dev] [PATCH babeltrace-1.5 6/6] Fix: lttng-live format: do not error out on empty streams hang up Mathieu Desnoyers
2019-12-13 1:03 ` Jérémie Galarneau
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=20191205065809.16728-5-mathieu.desnoyers@efficios.com \
--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