]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
fix a crash when MALLOC_DEBUG is enabled and the regexten is enabled. The crash
authorRussell Bryant <russell@russellbryant.com>
Thu, 27 Jul 2006 01:58:41 +0000 (01:58 +0000)
committerRussell Bryant <russell@russellbryant.com>
Thu, 27 Jul 2006 01:58:41 +0000 (01:58 +0000)
would occur when the extension got removed. (fixes issue #7484)

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

channels/chan_sip.c

index 7b67bebd08a9acd93d2032ba965542fa3c9ca669..d9ce9afdd4eb930a75b0ecbad2507a4a6e480d60 100644 (file)
@@ -953,6 +953,15 @@ static const struct ast_channel_tech sip_tech = {
        .send_text = sip_sendtext,
 };
 
+#ifdef __AST_DEBUG_MALLOC
+static void FREE(void *ptr)
+{
+       free(ptr);
+}
+#else
+#define FREE free
+#endif
+
 /*!
   \brief Thread-safe random number generator
   \return a random number
@@ -1625,7 +1634,7 @@ static void register_peer_exten(struct sip_peer *peer, int onoff)
                stringp = multi;
                while((ext = strsep(&stringp, "&"))) {
                        if (onoff)
-                               ast_add_extension(regcontext, 1, ext, 1, NULL, NULL, "Noop", strdup(peer->name), free, channeltype);
+                               ast_add_extension(regcontext, 1, ext, 1, NULL, NULL, "Noop", strdup(peer->name), FREE, channeltype);
                        else
                                ast_context_remove_extension(regcontext, ext, 1, NULL);
                }