about summary refs log tree commit diff
path: root/sysdeps/mach/munmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/mach/munmap.c')
-rw-r--r--sysdeps/mach/munmap.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sysdeps/mach/munmap.c b/sysdeps/mach/munmap.c
index f8c416f76f..cfd5daa3c1 100644
--- a/sysdeps/mach/munmap.c
+++ b/sysdeps/mach/munmap.c
@@ -27,6 +27,13 @@ int
 __munmap (__ptr_t addr, size_t len)
 {
   kern_return_t err;
+
+  if (addr == 0)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+
   if (err = __vm_deallocate (__mach_task_self (),
 			     (vm_address_t) addr, (vm_size_t) len))
     {