gdiplus: Fix a memory leak in GdipCreateMetafileFromWmf.
This commit is contained in:
parent
0c582dca3a
commit
01b32951a5
|
@ -1217,7 +1217,7 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE hwmf, BOOL delete,
|
|||
UINT read;
|
||||
BYTE* copy;
|
||||
HENHMETAFILE hemf;
|
||||
GpStatus retval = GenericError;
|
||||
GpStatus retval = Ok;
|
||||
|
||||
TRACE("(%p, %d, %p, %p)\n", hwmf, delete, placeable, metafile);
|
||||
|
||||
|
@ -1242,6 +1242,7 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE hwmf, BOOL delete,
|
|||
if(CreateStreamOnHGlobal(copy, TRUE, &stream) != S_OK){
|
||||
ERR("could not make stream\n");
|
||||
GdipFree(copy);
|
||||
retval = GenericError;
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -1253,7 +1254,10 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE hwmf, BOOL delete,
|
|||
|
||||
if(OleLoadPicture(stream, 0, FALSE, &IID_IPicture,
|
||||
(LPVOID*) &((*metafile)->image.picture)) != S_OK)
|
||||
{
|
||||
retval = GenericError;
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
||||
(*metafile)->image.type = ImageTypeMetafile;
|
||||
|
@ -1277,9 +1281,8 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE hwmf, BOOL delete,
|
|||
|
||||
TRACE("<-- %p\n", *metafile);
|
||||
|
||||
return Ok;
|
||||
|
||||
err:
|
||||
if (retval != Ok)
|
||||
GdipFree(*metafile);
|
||||
IStream_Release(stream);
|
||||
return retval;
|
||||
|
|
Loading…
Reference in New Issue