[5/6] gdiplus: do not prematurely free stream and buffer
Evan Stade
estade at gmail.com
Mon Aug 6 20:55:54 CDT 2007
Hi,
this fixes some overzealous freeing of memory
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 c74ae29..8040628 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -800,6 +800,8 @@ GpStatus WINGDIPAPI GdipCreateMetafileFr
if(!hwmf || !metafile || !placeable)
return InvalidParameter;
+
+ *metafile = NULL;
read = GetMetaFileBitsEx(hwmf, 0, NULL);
if(!read)
return GenericError;
@@ -816,20 +818,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);
@@ -843,11 +845,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