From 1fcae3c260a9a8809c733aa9c6b2b4c1c336f20c Mon Sep 17 00:00:00 2001 From: Alex Henrie Date: Wed, 11 Sep 2019 21:05:49 -0600 Subject: [PATCH] gdi32: Handle HeapAlloc failure in SetEnhMetaFileBits (scan-build). Signed-off-by: Alex Henrie Signed-off-by: Alexandre Julliard --- dlls/gdi32/enhmetafile.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/gdi32/enhmetafile.c b/dlls/gdi32/enhmetafile.c index a3360c269a5..fc3389ff23f 100644 --- a/dlls/gdi32/enhmetafile.c +++ b/dlls/gdi32/enhmetafile.c @@ -480,7 +480,9 @@ HENHMETAFILE WINAPI SetEnhMetaFileBits(UINT bufsize, const BYTE *buf) { ENHMETAHEADER *emh = HeapAlloc( GetProcessHeap(), 0, bufsize ); HENHMETAFILE hmf; - memmove(emh, buf, bufsize); + + if (!emh) return 0; + memcpy(emh, buf, bufsize); hmf = EMF_Create_HENHMETAFILE( emh, bufsize, FALSE ); if (!hmf) HeapFree( GetProcessHeap(), 0, emh );