Fixed off by one allocation error (DPA and DSA).
This commit is contained in:
parent
54d44d468c
commit
200f8921b1
@ -843,7 +843,7 @@ DSA_SetItem (const HDSA hdsa, INT nIndex, LPVOID pSrc)
|
|||||||
else {
|
else {
|
||||||
/* resize the block of memory */
|
/* resize the block of memory */
|
||||||
nNewItems =
|
nNewItems =
|
||||||
hdsa->nGrow * ((INT)((nIndex - 1) / hdsa->nGrow) + 1);
|
hdsa->nGrow * ((INT)(((nIndex + 1) - 1) / hdsa->nGrow) + 1);
|
||||||
nSize = hdsa->nItemSize * nNewItems;
|
nSize = hdsa->nItemSize * nNewItems;
|
||||||
|
|
||||||
lpTemp = (LPVOID)COMCTL32_ReAlloc (hdsa->pData, nSize);
|
lpTemp = (LPVOID)COMCTL32_ReAlloc (hdsa->pData, nSize);
|
||||||
@ -1349,7 +1349,7 @@ DPA_SetPtr (const HDPA hdpa, INT i, LPVOID p)
|
|||||||
else {
|
else {
|
||||||
/* resize the block of memory */
|
/* resize the block of memory */
|
||||||
INT nNewItems =
|
INT nNewItems =
|
||||||
hdpa->nGrow * ((INT)((i - 1) / hdpa->nGrow) + 1);
|
hdpa->nGrow * ((INT)(((i+1) - 1) / hdpa->nGrow) + 1);
|
||||||
INT nSize = nNewItems * sizeof(LPVOID);
|
INT nSize = nNewItems * sizeof(LPVOID);
|
||||||
|
|
||||||
lpTemp = (LPVOID*)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
|
lpTemp = (LPVOID*)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user