gdi32: Handle HeapAlloc failure in SetEnhMetaFileBits (scan-build).

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alex Henrie 2019-09-11 21:05:49 -06:00 committed by Alexandre Julliard
parent 0566ba9a58
commit 1fcae3c260
1 changed files with 3 additions and 1 deletions

View File

@ -480,7 +480,9 @@ HENHMETAFILE WINAPI SetEnhMetaFileBits(UINT bufsize, const BYTE *buf)
{ {
ENHMETAHEADER *emh = HeapAlloc( GetProcessHeap(), 0, bufsize ); ENHMETAHEADER *emh = HeapAlloc( GetProcessHeap(), 0, bufsize );
HENHMETAFILE hmf; HENHMETAFILE hmf;
memmove(emh, buf, bufsize);
if (!emh) return 0;
memcpy(emh, buf, bufsize);
hmf = EMF_Create_HENHMETAFILE( emh, bufsize, FALSE ); hmf = EMF_Create_HENHMETAFILE( emh, bufsize, FALSE );
if (!hmf) if (!hmf)
HeapFree( GetProcessHeap(), 0, emh ); HeapFree( GetProcessHeap(), 0, emh );