wrowe 2002/07/30 23:20:15
Modified: shmem/win32 shm.c
Log:
More handle leakage. We need to be explicit when we create a duplicate
handle for a child or all our children's children end up with the polution.
Revision Changes Path
1.12 +3 -11 apr/shmem/win32/shm.c
Index: shm.c
===================================================================
RCS file: /home/cvs/apr/shmem/win32/shm.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- shm.c 4 Jun 2002 04:41:53 -0000 1.11
+++ shm.c 31 Jul 2002 06:20:15 -0000 1.12
@@ -95,7 +95,6 @@
apr_pool_t *pool)
{
static apr_size_t memblock = 0;
- SECURITY_ATTRIBUTES sec, *psec;
HANDLE hMap, hFile;
apr_status_t rv;
apr_size_t size;
@@ -117,15 +116,9 @@
size = memblock * (1 + (reqsize - 1) / memblock);
if (!file) {
- /* Do Anonymous, which will be an inherited handle */
+ /* Do Anonymous, which must be passed as a duplicated handle */
#ifndef _WIN32_WCE
hFile = INVALID_HANDLE_VALUE;
- sec.nLength = sizeof(SECURITY_ATTRIBUTES);
- sec.lpSecurityDescriptor = NULL;
- sec.bInheritHandle = TRUE;
- psec = &sec;
-#else
- psec = NULL;
#endif
mapkey = NULL;
}
@@ -144,19 +137,18 @@
}
rv = apr_file_trunc(f, size);
mapkey = res_name_from_filename(file, 1, pool);
- psec = NULL;
}
#if APR_HAS_UNICODE_FS
IF_WIN_OS_IS_UNICODE
{
- hMap = CreateFileMappingW(hFile, psec, PAGE_READWRITE, 0, size,
mapkey);
+ hMap = CreateFileMappingW(hFile, NULL, PAGE_READWRITE, 0, size,
mapkey);
}
#endif
#if APR_HAS_ANSI_FS
ELSE_WIN_OS_IS_ANSI
{
- hMap = CreateFileMappingA(hFile, psec, PAGE_READWRITE, 0, size,
mapkey);
+ hMap = CreateFileMappingA(hFile, NULL, PAGE_READWRITE, 0, size,
mapkey);
}
#endif
err = apr_get_os_error();