Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Aleksandr Isakov
wine-fonts
Commits
2e61684c
Commit
2e61684c
authored
Apr 19, 2011
by
Thomas Mullaly
Committed by
Alexandre Julliard
Apr 22, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Prevent a race condition which results in handles being leaked.
parent
d0ea543f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
urlcache.c
dlls/wininet/urlcache.c
+9
-8
No files found.
dlls/wininet/urlcache.c
View file @
2e61684c
...
...
@@ -224,8 +224,12 @@ static DWORD URLCacheContainer_OpenIndex(URLCACHECONTAINER * pContainer)
static
const
WCHAR
wszIndex
[]
=
{
'i'
,
'n'
,
'd'
,
'e'
,
'x'
,
'.'
,
'd'
,
'a'
,
't'
,
0
};
static
const
WCHAR
wszMappingFormat
[]
=
{
'%'
,
's'
,
'%'
,
's'
,
'_'
,
'%'
,
'l'
,
'u'
,
0
};
if
(
pContainer
->
hMapping
)
WaitForSingleObject
(
pContainer
->
hMutex
,
INFINITE
);
if
(
pContainer
->
hMapping
)
{
ReleaseMutex
(
pContainer
->
hMutex
);
return
ERROR_SUCCESS
;
}
strcpyW
(
wszFilePath
,
pContainer
->
path
);
strcatW
(
wszFilePath
,
wszIndex
);
...
...
@@ -240,14 +244,10 @@ static DWORD URLCacheContainer_OpenIndex(URLCACHECONTAINER * pContainer)
if
(
hFile
==
INVALID_HANDLE_VALUE
)
{
TRACE
(
"Could not open or create cache index file
\"
%s
\"\n
"
,
debugstr_w
(
wszFilePath
));
ReleaseMutex
(
pContainer
->
hMutex
);
return
GetLastError
();
}
/* At this stage we need the mutex because we may be about to create the
* file.
*/
WaitForSingleObject
(
pContainer
->
hMutex
,
INFINITE
);
dwFileSize
=
GetFileSize
(
hFile
,
NULL
);
if
(
dwFileSize
==
INVALID_FILE_SIZE
)
{
...
...
@@ -420,8 +420,6 @@ static DWORD URLCacheContainer_OpenIndex(URLCACHECONTAINER * pContainer)
}
ReleaseMutex
(
pContainer
->
hMutex
);
wsprintfW
(
wszFilePath
,
wszMappingFormat
,
pContainer
->
path
,
wszIndex
,
dwFileSize
);
URLCache_PathToObjectName
(
wszFilePath
,
'_'
);
pContainer
->
hMapping
=
OpenFileMappingW
(
FILE_MAP_WRITE
,
FALSE
,
wszFilePath
);
...
...
@@ -431,9 +429,12 @@ static DWORD URLCacheContainer_OpenIndex(URLCACHECONTAINER * pContainer)
if
(
!
pContainer
->
hMapping
)
{
ERR
(
"Couldn't create file mapping (error is %d)
\n
"
,
GetLastError
());
ReleaseMutex
(
pContainer
->
hMutex
);
return
GetLastError
();
}
ReleaseMutex
(
pContainer
->
hMutex
);
return
ERROR_SUCCESS
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment