mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 14:49:29 +02:00
LCL: Win32: Prevent memory leak + exception when GlobalAlloc api fails. Leak reported on the forum.
git-svn-id: trunk@56908 -
This commit is contained in:
parent
c038b06190
commit
12997708a7
@ -1472,6 +1472,11 @@ begin
|
||||
// amount of ALLOC_UNIT number in this structure
|
||||
maxRects := ALLOC_UNIT;
|
||||
hData := GlobalAlloc(GMEM_MOVEABLE, sizeof(RGNDATAHEADER) + (sizeof(TRECT) * maxRects));
|
||||
if hData = 0 then
|
||||
begin
|
||||
FreeMem(Data);
|
||||
Exit;
|
||||
end;
|
||||
pData := GlobalLock(hData);
|
||||
pData^.rdh.dwSize := sizeof(RGNDATAHEADER);
|
||||
pData^.rdh.iType := RDH_RECTANGLES;
|
||||
|
Loading…
Reference in New Issue
Block a user