aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lib/free.c
diff options
context:
space:
mode:
Diffstat (limited to 'com32/lib/free.c')
-rw-r--r--com32/lib/free.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/com32/lib/free.c b/com32/lib/free.c
index be23865a..9fea69fb 100644
--- a/com32/lib/free.c
+++ b/com32/lib/free.c
@@ -107,6 +107,11 @@ void free(void *ptr)
assert(ah->a.type == ARENA_TYPE_USED);
#endif
+ if (ah->a.type != ARENA_TYPE_USED || ah->a.size == 0) {
+ printf("error in free, ptr = %p\n", ptr);
+ return;
+ }
+
__free_block(ah);
/* Here we could insert code to return memory to the system. */