View Issue Details

IDProjectCategoryView StatusLast Update
0001628GNUnetutil librarypublic2011-09-19 08:45
ReporterLRN Assigned ToNDurner Due Date
PriorityhighSeveritymajorReproducibilityN/A
Status closedResolutionfixed 
Summary0001628: Bad memory unmapping on W32
DescriptionUnmapViewOfFile() takes base address (as returned by MapViewOfFile()), not HANDLE.
Patch attached.
With this simple patch and with 0001616 fixed i was able to pass statistics test on W32
TagsNo tags attached.
Attached Files
0001-W32-unmap-fix.patch (1,281 bytes)   
From 4e568d23396bcdec86fc0191cf6e8380feddd192 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Mon, 6 Dec 2010 03:49:25 +0300
Subject: [PATCH] W32 unmap fix

---
 src/util/disk.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/util/disk.c b/src/util/disk.c
index 5d35fa0..b8bc946 100644
--- a/src/util/disk.c
+++ b/src/util/disk.c
@@ -1484,6 +1484,10 @@ struct GNUNET_DISK_MapHandle
    * Underlying OS handle.
    */
   HANDLE h;
+  /**
+   * Base address of the mapped memory.
+   */
+  void *base;
 #else
   /**
    * Address where the map is in memory.
@@ -1564,7 +1568,7 @@ GNUNET_DISK_file_map (const struct GNUNET_DISK_FileHandle *h,
       CloseHandle ((*m)->h);
       GNUNET_free (*m);
     }
-
+  (*m)->base = ret;
   return ret;
 #else
   int prot;
@@ -1603,7 +1607,7 @@ GNUNET_DISK_file_unmap (struct GNUNET_DISK_MapHandle *h)
     }
 
 #ifdef MINGW
-  ret = UnmapViewOfFile (h->h) ? GNUNET_OK : GNUNET_SYSERR;
+  ret = UnmapViewOfFile (h->base) ? GNUNET_OK : GNUNET_SYSERR;
   if (ret != GNUNET_OK)
     SetErrnoFromWinError (GetLastError ());
   if (!CloseHandle (h->h) && (ret == GNUNET_OK))
-- 
1.7.3.1.msysgit.0

0001-W32-unmap-fix.patch (1,281 bytes)   

Activities

NDurner

2010-12-13 21:05

reporter   ~0004205

fixed in r13899, thanks

Issue History

Date ModifiedUsernameFieldChange
2010-12-06 00:51LRNNew Issue
2010-12-06 00:51LRNFile Added: 0001-W32-unmap-fix.patch
2010-12-07 22:52NDurnerStatusnew => assigned
2010-12-07 22:52NDurnerAssigned To => NDurner
2010-12-09 10:44NDurnerStatusassigned => acknowledged
2010-12-13 10:43NDurnerStatusacknowledged => confirmed
2010-12-13 21:05NDurnerNote Added: 0004205
2010-12-13 21:05NDurnerStatusconfirmed => resolved
2010-12-13 21:05NDurnerFixed in Version => Git master
2010-12-13 21:05NDurnerResolutionopen => fixed
2010-12-23 22:50Christian GrothoffStatusresolved => closed
2011-09-19 08:45Christian GrothoffFixed in VersionGit master => 0.9.0pre3
2011-09-19 08:45Christian GrothoffTarget VersionGit master => 0.9.0pre3