]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 203231 via svnmerge from
authorMark Michelson <mmichelson@digium.com>
Thu, 25 Jun 2009 18:55:07 +0000 (18:55 +0000)
committerMark Michelson <mmichelson@digium.com>
Thu, 25 Jun 2009 18:55:07 +0000 (18:55 +0000)
https://origsvn.digium.com/svn/asterisk/trunk

................
  r203231 | mmichelson | 2009-06-25 13:53:12 -0500 (Thu, 25 Jun 2009) | 8 lines

  Blocked revisions 203230 via svnmerge

  ........
    r203230 | mmichelson | 2009-06-25 13:52:22 -0500 (Thu, 25 Jun 2009) | 3 lines

    Prevent false positives when freeing a NULL pointer with MALLOC_DEBUG enabled.
  ........
................

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

main/astmm.c

index e72c1e318d161725c906791fdb272541faaa6e0c..bbcc6b54e8a62311cd6e1eac9a8b2a6d29e96168 100644 (file)
@@ -157,10 +157,16 @@ static inline size_t __ast_sizeof_region(void *ptr)
 
 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) {
                if (reg->data == ptr) {