Huw Davies (@huw) commented about dlls/user32/tests/clipboard.c:
ok( r, "gle %ld\n", GetLastError() );
- r = open_clipboard( hwnd );
- ok( r, "Open clipboard failed: %#lx.\n", GetLastError() );
- r = EmptyClipboard();
- ok( r, "EmptyClipboard failed: %#lx.\n", GetLastError() );
- bitmap = CreateBitmap( 10, 10, 1, 1, NULL );
- h = SetClipboardData( CF_BITMAP, bitmap );
- ok( h == bitmap, "Expected bitmap %p, got %p.\n", bitmap, h );
- ok( !!DeleteObject( bitmap ), "DeleteObject failed.\n" );
- h = GetClipboardData( CF_BITMAP );
- ok( h == bitmap, "Expected bitmap %p, got %p.\n", bitmap, h );
- memset( &bmi, 0, sizeof(bmi) );
- bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
- result = GetDIBits( GetDC( 0 ), h, 0, 0, NULL, &bmi, 0 );
You're leaking a dc here. It's probably better to call `GetDC()` at the start of the function and `ReleaseDC()` at the end.