[asterisk-commits] russell: trunk r38286 - in /trunk: channel.c cli.c utils.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Jul 26 18:49:57 MST 2006


Author: russell
Date: Wed Jul 26 20:49:57 2006
New Revision: 38286

URL: http://svn.digium.com/view/asterisk?rev=38286&view=rev
Log:
fix crashes with MALLOC_DEBUG enabled that were a result of my recent thread
storage changes (fixes issue #7595)

Modified:
    trunk/channel.c
    trunk/cli.c
    trunk/utils.c

Modified: trunk/channel.c
URL: http://svn.digium.com/view/asterisk/trunk/channel.c?rev=38286&r1=38285&r2=38286&view=diff
==============================================================================
--- trunk/channel.c (original)
+++ trunk/channel.c Wed Jul 26 20:49:57 2006
@@ -160,6 +160,14 @@
 	{ AST_CAUSE_INTERWORKING, "INTERWORKING", "Interworking, unspecified" },
 };
 
+#ifdef __AST_DEBUG_MALLOC
+static void FREE(void *ptr)
+{
+	free(ptr);
+}
+#else
+#define FREE free
+#endif
 
 struct ast_variable *ast_channeltype_list(void)
 {
@@ -487,7 +495,7 @@
 
 static void state2str_buf_key_create(void)
 {
-	pthread_key_create(&state2str_buf_key, free);
+	pthread_key_create(&state2str_buf_key, FREE);
 }
  
 /*! \brief Gives the string form of a given channel state */

Modified: trunk/cli.c
URL: http://svn.digium.com/view/asterisk/trunk/cli.c?rev=38286&r1=38285&r2=38286&view=diff
==============================================================================
--- trunk/cli.c (original)
+++ trunk/cli.c Wed Jul 26 20:49:57 2006
@@ -57,9 +57,18 @@
 /*! \brief Initial buffer size for resulting strings in ast_cli() */
 #define AST_CLI_MAXSTRLEN   256
 
+#ifdef __AST_DEBUG_MALLOC
+static void FREE(void *ptr)
+{
+	free(ptr);
+}
+#else
+#define FREE free
+#endif
+
 static void ast_cli_buf_key_create(void)
 {
-	pthread_key_create(&ast_cli_buf_key, free);
+	pthread_key_create(&ast_cli_buf_key, FREE);
 }
 
 void ast_cli(int fd, char *fmt, ...)

Modified: trunk/utils.c
URL: http://svn.digium.com/view/asterisk/trunk/utils.c?rev=38286&r1=38285&r2=38286&view=diff
==============================================================================
--- trunk/utils.c (original)
+++ trunk/utils.c Wed Jul 26 20:49:57 2006
@@ -64,6 +64,15 @@
 
 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__)
 
@@ -488,7 +497,7 @@
 
 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 */



More information about the asterisk-commits mailing list