summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/astmm.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/main/astmm.c b/main/astmm.c
index 04a19037d..60543ecbc 100644
--- a/main/astmm.c
+++ b/main/astmm.c
@@ -156,10 +156,15 @@ 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) {