aboutsummaryrefslogtreecommitdiffstats
path: root/utils.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-07-27 01:49:57 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-07-27 01:49:57 +0000
commit2328f30da7a94bea19ab02b0fdb8f5ebf79d3f52 (patch)
treeb18f2f1e95153d05ed69d99381e8f9f296cbdad1 /utils.c
parent3336dbf9857f0db05c25391089b5f2dec6c36135 (diff)
fix crashes with MALLOC_DEBUG enabled that were a result of my recent thread
storage changes (fixes issue #7595) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@38286 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'utils.c')
-rw-r--r--utils.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/utils.c b/utils.c
index 0abc39a77..ef251bfa9 100644
--- a/utils.c
+++ b/utils.c
@@ -65,6 +65,15 @@ static char b2a[256];
static pthread_key_t inet_ntoa_buf_key;
static pthread_once_t inet_ntoa_buf_once = PTHREAD_ONCE_INIT;
+#ifdef __AST_DEBUG_MALLOC
+static void FREE(void *ptr)
+{
+ free(ptr);
+}
+#else
+#define FREE free
+#endif
+
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined( __NetBSD__ ) || defined(__APPLE__) || defined(__CYGWIN__)
#define ERANGE 34 /*!< duh? ERANGE value copied from web... */
@@ -488,7 +497,7 @@ void ast_uri_decode(char *s)
static void inet_ntoa_buf_key_create(void)
{
- pthread_key_create(&inet_ntoa_buf_key, free);
+ pthread_key_create(&inet_ntoa_buf_key, FREE);
}
/*! \brief ast_inet_ntoa: Recursive thread safe replacement of inet_ntoa */