aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
-rw-r--r--Makefile5
-rw-r--r--compat/mmap-blob.c4
2 files changed, 9 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index ed6fdb37..714348aa 100644
--- a/Makefile
+++ b/Makefile
@@ -9,6 +9,11 @@ LDFLAGS=-g
AR=ar
#
+# For debugging, uncomment the next one
+#
+CFLAGS += -DDEBUG
+
+#
# If building with shared libraries, you might
# want to add this
#
diff --git a/compat/mmap-blob.c b/compat/mmap-blob.c
index 3626cc73..1cab4dea 100644
--- a/compat/mmap-blob.c
+++ b/compat/mmap-blob.c
@@ -29,5 +29,9 @@ void blob_free(void *addr, unsigned long size)
{
if (!size || (size & ~CHUNK) || ((unsigned long) addr & 512))
die("internal error: bad blob free (%lu bytes at %p)", size, addr);
+#ifndef DEBUG
munmap(addr, size);
+#else
+ mprotect(addr, size, PROT_NONE);
+#endif
}