Commit 87c05c87 authored by Thomas Faber's avatar Thomas Faber Committed by Alexandre Julliard

winhttp: Return NULL on failure in alloc_handle.

parent 83413751
...@@ -89,9 +89,10 @@ void release_object( object_header_t *hdr ) ...@@ -89,9 +89,10 @@ void release_object( object_header_t *hdr )
HINTERNET alloc_handle( object_header_t *hdr ) HINTERNET alloc_handle( object_header_t *hdr )
{ {
object_header_t **p; object_header_t **p;
ULONG_PTR handle = 0, num; ULONG_PTR handle, num;
list_init( &hdr->children ); list_init( &hdr->children );
hdr->handle = NULL;
EnterCriticalSection( &handle_cs ); EnterCriticalSection( &handle_cs );
if (!max_handles) if (!max_handles)
...@@ -112,11 +113,12 @@ HINTERNET alloc_handle( object_header_t *hdr ) ...@@ -112,11 +113,12 @@ HINTERNET alloc_handle( object_header_t *hdr )
if (handles[handle]) ERR("handle isn't free but should be\n"); if (handles[handle]) ERR("handle isn't free but should be\n");
handles[handle] = addref_object( hdr ); handles[handle] = addref_object( hdr );
hdr->handle = (HINTERNET)(handle + 1);
while ((next_handle < max_handles) && handles[next_handle]) next_handle++; while ((next_handle < max_handles) && handles[next_handle]) next_handle++;
end: end:
LeaveCriticalSection( &handle_cs ); LeaveCriticalSection( &handle_cs );
return hdr->handle = (HINTERNET)(handle + 1); return hdr->handle;
} }
BOOL free_handle( HINTERNET hinternet ) BOOL free_handle( HINTERNET hinternet )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment