From cee693108aa95bccbf7f4c26fe906e2b8105411b Mon Sep 17 00:00:00 2001 From: Dan Kegel Date: Sun, 13 Jan 2008 17:42:28 -0800 Subject: [PATCH] gdiplus/tests: Don't free if alloc failed. --- dlls/gdiplus/tests/image.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c index 70685098dcc..03649622564 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);