From: Arran Cudbard-Bell Date: Fri, 1 Mar 2019 05:50:47 +0000 (+0800) Subject: Allow syserror to be explicitly freed X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b370ead4f7618b76e32ddfc2e1067a07aedfb86;p=thirdparty%2Ffreeradius-server.git Allow syserror to be explicitly freed --- diff --git a/src/bin/unit_test_module.c b/src/bin/unit_test_module.c index 28e3302f957..1fd3d9e4b28 100644 --- a/src/bin/unit_test_module.c +++ b/src/bin/unit_test_module.c @@ -1147,6 +1147,12 @@ cleanup: */ fr_dict_free(&dict); + /* + * Explicitly cleanup the buffer used for storing syserror messages + * This cuts down on address sanitiser output on error. + */ + fr_syserror_free(); + /* * Call pthread destructors. Which aren't normally * called for the main thread. diff --git a/src/lib/util/syserror.c b/src/lib/util/syserror.c index 0b1522f704a..6c38501eaaa 100644 --- a/src/lib/util/syserror.c +++ b/src/lib/util/syserror.c @@ -261,3 +261,11 @@ char const *fr_syserror(int num) #endif } +/** Explicitly cleanup the thread specific buffer used + * + */ +void fr_syserror_free(void) +{ + _fr_logging_free(NULL); +} + diff --git a/src/lib/util/syserror.h b/src/lib/util/syserror.h index 80147189c8d..5239ffc72a3 100644 --- a/src/lib/util/syserror.h +++ b/src/lib/util/syserror.h @@ -36,6 +36,7 @@ extern "C" { #include char const *fr_syserror(int num); +void fr_syserror_free(void); #ifdef __cplusplus }