[asterisk-commits] mmichelson: branch 1.4 r203230 - /branches/1.4/main/astmm.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 25 13:52:25 CDT 2009


Author: mmichelson
Date: Thu Jun 25 13:52:22 2009
New Revision: 203230

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=203230
Log:
Prevent false positives when freeing a NULL pointer with MALLOC_DEBUG enabled.


Modified:
    branches/1.4/main/astmm.c

Modified: branches/1.4/main/astmm.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.4/main/astmm.c?view=diff&rev=203230&r1=203229&r2=203230
==============================================================================
--- branches/1.4/main/astmm.c (original)
+++ branches/1.4/main/astmm.c Thu Jun 25 13:52:22 2009
@@ -157,9 +157,15 @@
 
 static void __ast_free_region(void *ptr, const char *file, int lineno, const char *func)
 {
-	int hash = HASH(ptr);
+	int hash;
 	struct ast_region *reg, *prev = NULL;
 	unsigned int *fence;
+
+	if (!ptr) {
+		return;
+	}
+
+	hash = HASH(ptr);
 
 	ast_mutex_lock(&reglock);
 	for (reg = regions[hash]; reg; reg = reg->next) {




More information about the asterisk-commits mailing list