From 5836b9652ba9dce2e3fa8dc51b30388e3f3819a5 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Sun, 24 Nov 2019 03:59:54 +0400 Subject: [PATCH] [Unit-tests] Fix test framework leaking on successful checks under setup or teardown mode. Failed checks in these modes are noted and then freed, but not when passed. --- src/include/test/switch_fct.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/include/test/switch_fct.h b/src/include/test/switch_fct.h index f2de6920f7..ab70d882c5 100644 --- a/src/include/test/switch_fct.h +++ b/src/include/test/switch_fct.h @@ -3663,9 +3663,12 @@ with. If we fail a setup up, then we go directly to a teardown mode. */ fct_ts__add_test( \ fctkern_ptr__->ns.ts_curr, fctkern_ptr__->ns.curr_test \ ); \ + } else { \ + fct_test__del(fctkern_ptr__->ns.curr_test); \ + fctkern_ptr__->ns.curr_test = NULL; \ } \ } else { \ - switch_assert("invalid condition for fct_req!"); \ + switch_assert("invalid condition for fct_req!"); \ _fct_req((_CNDTN_)); \ }