From: Arran Cudbard-Bell Date: Wed, 5 Jan 2022 17:59:25 +0000 (-0600) Subject: Don't evaluate _uctx multiple times in fr_atexit_thread_local X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0781f0b01d252e66cb24f19a37ab8799ca6aa7f2;p=thirdparty%2Ffreeradius-server.git Don't evaluate _uctx multiple times in fr_atexit_thread_local --- diff --git a/src/lib/util/atexit.h b/src/lib/util/atexit.h index 769fe2f3fa..2f329c67f7 100644 --- a/src/lib/util/atexit.h +++ b/src/lib/util/atexit.h @@ -105,8 +105,9 @@ int _atexit_global(NDEBUG_LOCATION_ARGS fr_atexit_t func, void const *uctx); */ # define fr_atexit_thread_local(_name, _free, _uctx) \ do { \ - _fr_atexit_thread_local(NDEBUG_LOCATION_EXP _free, _uctx); \ - _name = _uctx; \ + void *_our_uctx = _uctx; /* stop _uctx being evaluated multiple times, it may be a call to malloc() */ \ + _fr_atexit_thread_local(NDEBUG_LOCATION_EXP _free, _our_uctx); \ + _name = _our_uctx; \ } while (0); int _fr_atexit_thread_local(NDEBUG_LOCATION_ARGS