From 0232a5357bdd3748574ce23181c57eca702ccc87 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Thu, 4 Jul 2019 01:58:46 -0400 Subject: [PATCH] cli: clear current thread's error, if any, before exiting Because the CLI is not consuming the current thread's error yet, clear it every time to avoid a memory leak. Signed-off-by: Philippe Proulx Change-Id: Ifb36292a20a5592e660ce16201ee13e017d01780 Reviewed-on: https://review.lttng.org/c/babeltrace/+/1614 Tested-by: jenkins Reviewed-by: Francis Deslauriers Reviewed-by: Simon Marchi --- src/cli/babeltrace2.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/cli/babeltrace2.c b/src/cli/babeltrace2.c index e5d4370c..78d7b9b6 100644 --- a/src/cli/babeltrace2.c +++ b/src/cli/babeltrace2.c @@ -2866,5 +2866,11 @@ int main(int argc, const char **argv) end: BT_OBJECT_PUT_REF_AND_RESET(cfg); fini_static_data(); + + /* + * Clear current thread's error in case there is one to avoid a + * memory leak. + */ + bt_current_thread_clear_error(); return retcode; } -- 2.34.1