From: Philippe Proulx Date: Thu, 4 Jul 2019 05:58:46 +0000 (-0400) Subject: cli: clear current thread's error, if any, before exiting X-Git-Url: https://git.efficios.com/?a=commitdiff_plain;h=0232a5357bdd3748574ce23181c57eca702ccc87;p=babeltrace.git 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 --- 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; }