summaryrefslogtreecommitdiff
path: root/utils.c
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2006-07-27 01:49:57 +0000
committerRussell Bryant <russell@russellbryant.com>2006-07-27 01:49:57 +0000
commit7b8d8c9bb52fba8c3afd3f05170f54240be3eb48 (patch)
treeb18f2f1e95153d05ed69d99381e8f9f296cbdad1 /utils.c
parenta43a350c3e654cedc0fe3a48f9e8b673ad417d92 (diff)
fix crashes with MALLOC_DEBUG enabled that were a result of my recent thread
storage changes (fixes issue #7595) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@38286 65c4cc65-6c06-0410-ace0-fbb531ad65f3
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 */