[asterisk-commits] mmichelson: trunk r240420 - /trunk/main/utils.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 15 14:58:28 CST 2010


Author: mmichelson
Date: Fri Jan 15 14:58:24 2010
New Revision: 240420

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=240420
Log:
Make sure to set owner_line, ownder_func, and owner_file in ast_calloc_with_stringfields.

Asterisk would crash on startup if MALLOC_DEBUG were set in menuselect. This is because
the manager action UpdateConfig had to resize its string field allocation to set the
description. When the resize occurred, ast_copy_string would crash because we were
attempting to copy a string from a NULL pointer. Setting the strings initially makes
the code much less crashy.


Modified:
    trunk/main/utils.c

Modified: trunk/main/utils.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/utils.c?view=diff&rev=240420&r1=240419&r2=240420
==============================================================================
--- trunk/main/utils.c (original)
+++ trunk/main/utils.c Fri Jan 15 14:58:24 2010
@@ -1792,6 +1792,11 @@
 		mgr->embedded_pool = pool;
 		*pool_head = pool;
 		pool->size = size_to_alloc - struct_size - sizeof(*pool);
+#if defined(__AST_DEBUG_MALLOC)
+		mgr->owner_file = file;
+		mgr->owner_func = func;
+		mgr->owner_line = lineno;
+#endif
 	}
 
 	return allocation;




More information about the asterisk-commits mailing list