From: Ruslan Garipov ruslanngaripov@gmail.com
If the malloc(3) has failed to allocate the memory in the init_xdg_dirs(), the latter returns nonzero value, but the 'file' handle is kept open. This closes the handle before return from the init_xdg_dirs() if the malloc(3) has failed.
Signed-off-by: Ruslan Garipov ruslanngaripov@gmail.com --- dlls/shell32/shellpath.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c index 7fbded5743b..068859b9571 100644 --- a/dlls/shell32/shellpath.c +++ b/dlls/shell32/shellpath.c @@ -2678,7 +2678,11 @@ static BOOL WINAPI init_xdg_dirs( INIT_ONCE *once, void *param, void **context ) if (file != INVALID_HANDLE_VALUE) { len = GetFileSize( file, NULL ); - if (!(xdg_config = malloc( len + 1 ))) return TRUE; + if (!(xdg_config = malloc( len + 1 ))) + { + CloseHandle( file ); + return TRUE; + } if (!ReadFile( file, xdg_config, len, &xdg_config_len, NULL )) { free( xdg_config );