summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/mmapmodule.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index cff3c14..f1df4dc 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -141,8 +141,10 @@ mmap_close_method(mmap_object *self, PyObject *args)
#endif /* MS_WINDOWS */
#ifdef UNIX
- munmap(self->data, self->size);
- self->data = NULL;
+ if (self->data != NULL) {
+ munmap(self->data, self->size);
+ self->data = NULL;
+ }
#endif
Py_INCREF (Py_None);