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

........
r38288 | russell | 2006-07-26 21:58:41 -0400 (Wed, 26 Jul 2006) | 3 lines

fix a crash when MALLOC_DEBUG is enabled and the regexten is enabled. The crash
would occur when the extension got removed. (fixes issue #7484)

........

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

channels/chan_sip.c

index 4020957..087e109 100644 (file)
@@ -1537,6 +1537,15 @@ static struct ast_udptl_protocol sip_udptl = {
        set_udptl_peer: sip_set_udptl_peer,
 };
 
+#ifdef __AST_DEBUG_MALLOC
+static void FREE(void *ptr)
+{
+       free(ptr);
+}
+#else
+#define FREE free
+#endif
+
 /*! \brief Convert transfer status to string */
 static char *referstatus2str(enum referstatus rstatus)
 {
@@ -2243,7 +2252,7 @@ static void register_peer_exten(struct sip_peer *peer, int onoff)
                }
                if (onoff)
                        ast_add_extension(context, 1, ext, 1, NULL, NULL, "Noop",
-                                ast_strdup(peer->name), free, "SIP");
+                                ast_strdup(peer->name), FREE, "SIP");
                else
                        ast_context_remove_extension(context, ext, 1, NULL);
        }