diff --git a/dlls/comctl32/comctl32undoc.c b/dlls/comctl32/comctl32undoc.c index ce7409940a5..416d35d84c9 100644 --- a/dlls/comctl32/comctl32undoc.c +++ b/dlls/comctl32/comctl32undoc.c @@ -843,7 +843,7 @@ DSA_SetItem (const HDSA hdsa, INT nIndex, LPVOID pSrc) else { /* resize the block of memory */ nNewItems = - hdsa->nGrow * ((INT)((nIndex - 1) / hdsa->nGrow) + 1); + hdsa->nGrow * ((INT)(((nIndex + 1) - 1) / hdsa->nGrow) + 1); nSize = hdsa->nItemSize * nNewItems; lpTemp = (LPVOID)COMCTL32_ReAlloc (hdsa->pData, nSize); @@ -1349,7 +1349,7 @@ DPA_SetPtr (const HDPA hdpa, INT i, LPVOID p) else { /* resize the block of memory */ INT nNewItems = - hdpa->nGrow * ((INT)((i - 1) / hdpa->nGrow) + 1); + hdpa->nGrow * ((INT)(((i+1) - 1) / hdpa->nGrow) + 1); INT nSize = nNewItems * sizeof(LPVOID); lpTemp = (LPVOID*)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,