summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qstd/memory.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/qstd/memory.c b/qstd/memory.c
index 6ea43f7..81795d6 100644
--- a/qstd/memory.c
+++ b/qstd/memory.c
@@ -130,6 +130,7 @@ void* imp_heap_alloc(Heap* h, int s) {
void imp_heap_free(Heap* h, void* p) {
assert((char*)p > h->buf);
assert((char*)p < h->buf + h->size);
+ assert(((int*)p)[-1] & ~((unsigned)-1 >> 1)); /* double free */
(void)h;
((int*)p)[-1] &= (unsigned)-1 >> 1;
}