Dan Kegel : gdiplus/tests: Don't free if alloc failed.

Alexandre Julliard julliard at winehq.org
Mon Jan 14 09:33:14 CST 2008


Module: wine
Branch: master
Commit: cee693108aa95bccbf7f4c26fe906e2b8105411b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=cee693108aa95bccbf7f4c26fe906e2b8105411b

Author: Dan Kegel <dank at kegel.com>
Date:   Sun Jan 13 17:42:28 2008 -0800

gdiplus/tests: Don't free if alloc failed.

---

 dlls/gdiplus/tests/image.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c
index 7068509..0364962 100644
--- a/dlls/gdiplus/tests/image.c
+++ b/dlls/gdiplus/tests/image.c
@@ -34,7 +34,8 @@ static void test_Scan0(void)
     stat = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat24bppRGB, NULL, &bm);
     expect(Ok, stat);
     ok(NULL != bm, "Expected bitmap to be initialized\n");
-    GdipDisposeImage((GpImage*)bm);
+    if (stat == Ok)
+        GdipDisposeImage((GpImage*)bm);
 
     bm = (GpBitmap*)0xdeadbeef;
     stat = GdipCreateBitmapFromScan0(10, -10, 10, PixelFormat24bppRGB, NULL, &bm);
@@ -58,7 +59,8 @@ static void test_Scan0(void)
     stat = GdipCreateBitmapFromScan0(10, 10, 12, PixelFormat24bppRGB, buff, &bm);
     expect(Ok, stat);
     ok(NULL != bm, "Expected bitmap to be initialized\n");
-    GdipDisposeImage((GpImage*)bm);
+    if (stat == Ok)
+        GdipDisposeImage((GpImage*)bm);
 
     bm = (GpBitmap*) 0xdeadbeef;
     stat = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat24bppRGB, buff, &bm);




More information about the wine-cvs mailing list