[asterisk-commits] mmichelson: trunk r143400 - /trunk/main/astmm.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Sep 17 15:25:40 CDT 2008
Author: mmichelson
Date: Wed Sep 17 15:25:40 2008
New Revision: 143400
URL: http://svn.digium.com/view/asterisk?view=rev&rev=143400
Log:
If attempting to free a NULL pointer when MALLOC_DEBUG
is set, don't bother searching for a region to free, just
immediately exit.
This has the dual benefit of suppressing a warning message
about freeing memory at (nil) and of optimizing the free()
replacement by not having to do any futile searching for
the proper region to free.
(closes issue #13498)
Reported by: pj
Patches:
13498.patch uploaded by putnopvut (license 60)
Tested by: pj
Modified:
trunk/main/astmm.c
Modified: trunk/main/astmm.c
URL: http://svn.digium.com/view/asterisk/trunk/main/astmm.c?view=diff&rev=143400&r1=143399&r2=143400
==============================================================================
--- trunk/main/astmm.c (original)
+++ trunk/main/astmm.c Wed Sep 17 15:25:40 2008
@@ -156,9 +156,14 @@
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(®lock);
for (reg = regions[hash]; reg; reg = reg->next) {
More information about the asterisk-commits
mailing list