@@ -22,7 +22,7 @@ static void test_LoadImage_1bpp(void)
2222 if (res_obj == HGDI_ERROR || res_obj == NULL )
2323 {
2424 skip ("Could not load 1 BPP bitmap\n" );
25- return ;
25+ goto Cleanup ;
2626 }
2727 GetObject (hBmp1 , sizeof (BITMAP ), & bitmap1 );
2828
@@ -49,7 +49,7 @@ static void test_LoadImage_1bpp(void)
4949 if (!result )
5050 {
5151 skip ("GetDIBits failed for 1 BPP bitmap\n" );
52- return ;
52+ goto Cleanup ;
5353 }
5454
5555 /* Get bytes from bitmap (we know its 4x4 1BPP */
@@ -82,7 +82,7 @@ static void test_LoadImage_1bpp(void)
8282 if (res_obj == HGDI_ERROR || res_obj == NULL )
8383 {
8484 skip ("Could not load 1 BPP bitmap\n" );
85- return ;
85+ goto Cleanup ;
8686 }
8787 GetObject (hBmp2 , sizeof (BITMAP ), & bitmap2 );
8888 ok (bitmap2 .bmBitsPixel == 1 , "Should have been '1', but got %d\n" , bitmap2 .bmBitsPixel );
@@ -106,7 +106,7 @@ static void test_LoadImage_1bpp(void)
106106 if (!result )
107107 {
108108 skip ("GetDIBits failed for 1 BPP bitmap\n" );
109- return ;
109+ goto Cleanup ;
110110 }
111111
112112 /* Clear img array for new test */
@@ -135,10 +135,11 @@ static void test_LoadImage_1bpp(void)
135135 ok (img [14 ] == 0 , "Got 0x%02x, expected 0\n" , img [14 ]);
136136 ok (img [15 ] == 0 , "Got 0x%02x, expected 0\n" , img [15 ]);
137137
138- GlobalUnlock (hMem );
139- GlobalFree (hMem );
140- DeleteDC (hdc1 );
141- DeleteDC (hdc2 );
138+ Cleanup :
139+ if (hMem ) GlobalUnlock (hMem );
140+ if (hMem ) GlobalFree (hMem );
141+ if (hdc1 ) DeleteDC (hdc1 );
142+ if (hdc2 ) DeleteDC (hdc2 );
142143}
143144
144145static void test_LoadImage_DataFile (void )
0 commit comments