Merged revisions 38328 via svnmerge from
authorRussell Bryant <russell@russellbryant.com>
Thu, 27 Jul 2006 04:28:09 +0000 (04:28 +0000)
committerRussell Bryant <russell@russellbryant.com>
Thu, 27 Jul 2006 04:28:09 +0000 (04:28 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r38328 | russell | 2006-07-27 00:25:41 -0400 (Thu, 27 Jul 2006) | 4 lines

Fix crash when using the "regexten" option with MALLOC_DEBUG enabled.  This was
not reported in the bug tracker but the same bug has been demonstrated in other
places in the code.

........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@38329 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_iax2.c

index d1062a5..70f40c4 100644 (file)
@@ -702,6 +702,15 @@ static AST_LIST_HEAD_STATIC(dynamic_list, iax2_thread);
 
 static void *iax2_process_thread(void *data);
 
+#ifdef __AST_DEBUG_MALLOC
+static void FREE(void *ptr)
+{
+       free(ptr);
+}
+#else
+#define FREE free
+#endif
+
 static void signal_condition(ast_mutex_t *lock, ast_cond_t *cond)
 {
        ast_mutex_lock(lock);
@@ -5441,7 +5450,7 @@ static void register_peer_exten(struct iax2_peer *peer, int onoff)
                        if (onoff) {
                                if (!ast_exists_extension(NULL, regcontext, ext, 1, NULL))
                                        ast_add_extension(regcontext, 1, ext, 1, NULL, NULL,
-                                                         "Noop", ast_strdup(peer->name), free, "IAX2");
+                                                         "Noop", ast_strdup(peer->name), FREE, "IAX2");
                        } else
                                ast_context_remove_extension(regcontext, ext, 1, NULL);
                }