diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 3d16bbe3b..9c08c56da 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2009-08-21 Corinna Vinschen + + * mmap.cc (mmap64): Allocate fh_disk_file on cygheap. Delete + explicitely before returning. + 2009-08-20 Corinna Vinschen * dtable.cc (build_fh_dev): Take additional bool parameter indicating diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc index 94dee5e4d..6be40a1b3 100644 --- a/winsup/cygwin/mmap.cc +++ b/winsup/cygwin/mmap.cc @@ -849,7 +849,8 @@ mmap64 (void *addr, size_t len, int prot, int flags, int fd, _off64_t off) | FILE_OPEN_FOR_BACKUP_INTENT); if (NT_SUCCESS (status)) { - fh_disk_file = new (alloca (sizeof *fh_disk_file)) fhandler_disk_file; + fh_disk_file = new (ccalloc (HEAP_FHANDLER, 1, sizeof *fh_disk_file)) + fhandler_disk_file; fh_disk_file->set_name (fh->pc); fh_disk_file->set_io_handle (h); fh_disk_file->set_access (fh->get_access () | GENERIC_EXECUTE); @@ -1042,7 +1043,10 @@ out_with_unlock: out: if (fh_disk_file) - NtClose (fh_disk_file->get_handle ()); + { + NtClose (fh_disk_file->get_handle ()); + delete fh; + } syscall_printf ("%p = mmap() ", ret); return ret;