Index: main/astmm.c =================================================================== --- main/astmm.c (revision 143349) +++ main/astmm.c (working copy) @@ -156,10 +156,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(®lock); for (reg = regions[hash]; reg; reg = reg->next) { if (reg->data == ptr) {