Skip to content

Commit

Permalink
Merge pull request #104 from redjack/feature/debug-assert
Browse files Browse the repository at this point in the history
Debug allocator should always abort
  • Loading branch information
Douglas Creager committed Jun 29, 2015
2 parents 43f6597 + 939ba35 commit 1ccea38
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/libcork/core/allocator.c
Expand Up @@ -403,7 +403,11 @@ cork_debug_alloc__free(const struct cork_alloc *alloc, void *ptr,
size_t *base = ((size_t *) ptr) - 1;
size_t actual_size = *base;
size_t real_size = actual_size + sizeof(size_t);
assert(actual_size == expected_size);
if (CORK_UNLIKELY(actual_size != expected_size)) {
cork_abort
("Incorrect size when freeing pointer (got %zu, expected %zu)",
expected_size, actual_size);
}
cork_alloc_free(alloc->parent, base, real_size);
}

Expand Down

0 comments on commit 1ccea38

Please sign in to comment.