summaryrefslogtreecommitdiff
path: root/source3/lib/util_file.c
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2006-04-08 17:25:31 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:15:55 -0500
commitbbf666e447132a5f6b206ddf9ca918298b756392 (patch)
tree3cac70deddd159edbd7fb3aece639c48e9a5e67e /source3/lib/util_file.c
parentc9c502442b40aba97de17456ba948effcdfa3d05 (diff)
downloadsamba-bbf666e447132a5f6b206ddf9ca918298b756392.tar.gz
samba-bbf666e447132a5f6b206ddf9ca918298b756392.tar.bz2
samba-bbf666e447132a5f6b206ddf9ca918298b756392.zip
r15003: patch based on code from Arkady Glabek <aglabek@centeris.com> to ensure that global memory is freed when unloading pam_winbind.so (needs more testing on non-linux platforms)
(This used to be commit 1e0b79e591d70352a96e0a0487d8f394dc7b36ba)
Diffstat (limited to 'source3/lib/util_file.c')
-rw-r--r--source3/lib/util_file.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/source3/lib/util_file.c b/source3/lib/util_file.c
index 06008886c0..fff564aeb0 100644
--- a/source3/lib/util_file.c
+++ b/source3/lib/util_file.c
@@ -441,6 +441,26 @@ char *file_load(const char *fname, size_t *size, size_t maxsize)
}
/*******************************************************************
+ unmap or free memory
+*******************************************************************/
+
+BOOL unmap_file(void* start, size_t size)
+{
+#ifdef HAVE_MMAP
+ if ( munmap( start, size ) != 0 ) {
+ DEBUG( 1, ("map_file: Failed to unmap address %X "
+ "of size %d - %s\n",
+ start, size, strerror(errno) ));
+ return False;
+ }
+ return True;
+#else
+ SAFE_FREE( start );
+ return True;
+#endif
+}
+
+/*******************************************************************
mmap (if possible) or read a file.
********************************************************************/