0.2.1 fix the munmap call
authorCΓ©dric Villemain <cedric.villemain.debian@gmail.com>
Sun, 9 Aug 2009 23:56:43 +0000 (01:56 +0200)
committerCΓ©dric Villemain <cedric.villemain.debian@gmail.com>
Sun, 9 Aug 2009 23:56:43 +0000 (01:56 +0200)
pgfincore.c

index f93e4b04f51d5a286b5735154b8dc8b2bdb8a715..2763df4e5ee8e540eb2a233b3a9ffb90536c268b 100644 (file)
@@ -200,7 +200,7 @@ pgfincore_file(char *filename) {
 
   vec = calloc(1, (st.st_size+pageSize-1)/pageSize);
   if ((void *)0 == vec) {
-    munmap(pa, (st.st_size+pageSize-1)/pageSize);
+    munmap(pa, st.st_size);
     close(fd);
     elog(ERROR, "Can not calloc object file : %s", filename);
     return -1;
@@ -231,7 +231,7 @@ pgfincore_file(char *filename) {
 
 //   free things
   free(vec);
-  munmap(pa, (st.st_size+pageSize-1)/pageSize);
+  munmap(pa, st.st_size);
   close(fd);
 
   elog(DEBUG1, "pgfincore %s: %lu of %lu block in linux cache, %lu groups",filename, (unsigned long)n, (unsigned long)(st.st_size/pageSize), (unsigned long)cut);