gdi: fix incorrect usage of realloc.

Signed-off-by: Zhang Zhaolong <zhangzl2013@126.com>
This commit is contained in:
Zhang Zhaolong 2015-03-11 13:55:41 +08:00
parent a52e7f012d
commit bd234419b8
1 changed files with 9 additions and 2 deletions

View File

@ -384,8 +384,15 @@ INLINE int gdi_InvalidateRegion(HGDI_DC hdc, int x, int y, int w, int h)
if ((hdc->hwnd->ninvalid + 1) > hdc->hwnd->count)
{
hdc->hwnd->count *= 2;
cinvalid = (HGDI_RGN) realloc(cinvalid, sizeof(GDI_RGN) * (hdc->hwnd->count));
int new_cnt;
HGDI_RGN new_rgn;
new_cnt = hdc->hwnd->count * 2;
new_rgn = (HGDI_RGN) realloc(cinvalid, sizeof(GDI_RGN) * new_cnt);
if (!new_rgn)
return -1;
hdc->hwnd->count = new_cnt;
cinvalid = new_rgn;
}
gdi_SetRgn(&cinvalid[hdc->hwnd->ninvalid++], x, y, w, h);