[6/19] gdiplus: don't prematurely release stream
Evan Stade
estade at gmail.com
Tue Aug 7 20:42:16 CDT 2007
Hi,
dlls/gdiplus/graphics.c | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
--
Evan Stade
-------------- next part --------------
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 8d31661..3afdab2 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -803,6 +803,8 @@ GpStatus WINGDIPAPI GdipCreateMetafileFr
if(!hwmf || !metafile || !placeable)
return InvalidParameter;
+
+ *metafile = NULL;
read = GetMetaFileBitsEx(hwmf, 0, NULL);
if(!read)
return GenericError;
@@ -819,20 +821,20 @@ GpStatus WINGDIPAPI GdipCreateMetafileFr
if(CreateStreamOnHGlobal(copy, TRUE, &stream) != S_OK){
ERR("could not make stream\n");
- goto end;
+ GdipFree(copy);
+ goto err;
}
*metafile = GdipAlloc(sizeof(GpMetafile));
if(!*metafile){
retval = OutOfMemory;
- goto end;
+ goto err;
}
if(OleLoadPicture(stream, 0, FALSE, &IID_IPicture,
- (LPVOID*) &((*metafile)->image.picture)) != S_OK){
- GdipFree(*metafile);
- goto end;
- }
+ (LPVOID*) &((*metafile)->image.picture)) != S_OK)
+ goto err;
+
(*metafile)->image.type = ImageTypeMetafile;
(*metafile)->bounds.X = ((REAL) placeable->BoundingBox.Left) / ((REAL) placeable->Inch);
@@ -846,11 +848,11 @@ GpStatus WINGDIPAPI GdipCreateMetafileFr
if(delete)
DeleteMetaFile(hwmf);
- retval = Ok;
+ return Ok;
-end:
+err:
+ GdipFree(*metafile);
IStream_Release(stream);
- GdipFree(copy);
return retval;
}
--
1.4.1
More information about the wine-patches
mailing list