Module: wine Branch: master Commit: 87c05c87795ecd5e5290061d0ddd6205fef2cd7f URL: http://source.winehq.org/git/wine.git/?a=commit;h=87c05c87795ecd5e5290061d0d...
Author: Thomas Faber thomas.faber@reactos.org Date: Sun Jun 26 01:53:28 2016 +0200
winhttp: Return NULL on failure in alloc_handle.
Signed-off-by: Thomas Faber thomas.faber@reactos.org Signed-off-by: Hans Leidekker hans@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/winhttp/handle.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/winhttp/handle.c b/dlls/winhttp/handle.c index aa980ed..6026a49 100644 --- a/dlls/winhttp/handle.c +++ b/dlls/winhttp/handle.c @@ -89,9 +89,10 @@ void release_object( object_header_t *hdr ) HINTERNET alloc_handle( object_header_t *hdr ) { object_header_t **p; - ULONG_PTR handle = 0, num; + ULONG_PTR handle, num;
list_init( &hdr->children ); + hdr->handle = NULL;
EnterCriticalSection( &handle_cs ); if (!max_handles) @@ -112,11 +113,12 @@ HINTERNET alloc_handle( object_header_t *hdr ) if (handles[handle]) ERR("handle isn't free but should be\n");
handles[handle] = addref_object( hdr ); + hdr->handle = (HINTERNET)(handle + 1); while ((next_handle < max_handles) && handles[next_handle]) next_handle++;
end: LeaveCriticalSection( &handle_cs ); - return hdr->handle = (HINTERNET)(handle + 1); + return hdr->handle; }
BOOL free_handle( HINTERNET hinternet )