diff options
Diffstat (limited to 'include/asterisk/utils.h')
-rw-r--r-- | include/asterisk/utils.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h index ba1cd5948..ea8b352fb 100644 --- a/include/asterisk/utils.h +++ b/include/asterisk/utils.h @@ -35,6 +35,7 @@ #include "asterisk/time.h" #include "asterisk/strings.h" #include "asterisk/logger.h" +#include "asterisk/compiler.h" /*! \note \verbatim @@ -272,6 +273,22 @@ int getloadavg(double *list, int nelem); long int ast_random(void); #endif +/*! + * \brief free() wrapper + * + * ast_free should be used when a function pointer for free() needs to be passed + * as the argument to a function. Otherwise, astmm will cause seg faults. + */ +#ifdef __AST_DEBUG_MALLOC +static void ast_free(void *ptr) attribute_unused; +static void ast_free(void *ptr) +{ + free(ptr); +} +#else +#define ast_free free +#endif + #ifndef __AST_DEBUG_MALLOC /*! |