Skip to content

Commit

Permalink
ntdll: Fix growing the shm_addrs array.
Browse files Browse the repository at this point in the history
Fixes an issue exposed by the last patch and visible in GTA V. Presumably
this didn't show up earlier because applications usually don't create large
numbers of semaphores or mutexes, and previously events didn't use shared
memory.
  • Loading branch information
zfigura authored and imaami committed Aug 17, 2019
1 parent 98fd5d5 commit 1590afb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dlls/ntdll/esync.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,9 @@ static void *get_shm( unsigned int idx )

if (entry >= shm_addrs_size)
{
shm_addrs_size *= 2;
if (!(shm_addrs = RtlReAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY, shm_addrs, shm_addrs_size )))
shm_addrs_size = entry + 1;
if (!(shm_addrs = RtlReAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY,
shm_addrs, shm_addrs_size * sizeof(shm_addrs[0]) )))
ERR("Failed to grow shm_addrs array to size %d.\n", shm_addrs_size);
}

Expand Down

0 comments on commit 1590afb

Please sign in to comment.