DXGL r17 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r16‎ | r17 | r18 >
Date:03:32, 4 December 2011
Author:admin
Status:new
Tags:
Comment:
Fix palette memory leak in dxgltest
Modified paths:
  • /dxgltest/Tests2D.cpp (modified) (history)

Diff [purge]

Index: dxgltest/Tests2D.cpp
@@ -39,6 +39,7 @@
4040 MultiDirectDraw *ddinterface;
4141 MultiDirectDrawSurface *ddsurface;
4242 MultiDirectDrawSurface *ddsrender;
 43+IDirectDrawPalette *pal;
4344 LPDIRECTDRAWCLIPPER ddclipper;
4445 int width,height,bpp,refresh,backbuffers;
4546 double fps;
@@ -88,6 +89,11 @@
8990 ddsurface->Release();
9091 ddsurface = NULL;
9192 }
 93+ if(pal)
 94+ {
 95+ pal->Release();
 96+ pal = NULL;
 97+ }
9298 if(ddclipper)
9399 {
94100 ddclipper->Release();
@@ -227,11 +233,10 @@
228234 }
229235 if(bpp == 8)
230236 {
231 - IDirectDrawPalette *pal;
232237 ddinterface->CreatePalette(DDPCAPS_8BIT|DDPCAPS_ALLOW256,(LPPALETTEENTRY)&DefaultPalette,&pal,NULL);
233238 ddsrender->SetPalette(pal);
234 - pal->Release();
235239 }
 240+ else pal = NULL;
236241 InitTest(testnum);
237242 if(!fullscreen) SendMessage(hWnd,WM_PAINT,0,0);
238243 if(testtypes[testnum] == 1)