From c88a9d875cb30a7bd30257fdc5de5f4ac88a3f8b Mon Sep 17 00:00:00 2001 From: Christian Gmeiner Date: Tue, 13 Oct 2009 12:58:53 +0200 Subject: dont leak memory --- dxr3osd.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'dxr3osd.c') diff --git a/dxr3osd.c b/dxr3osd.c index 64a2460..9a20ef1 100644 --- a/dxr3osd.c +++ b/dxr3osd.c @@ -235,6 +235,7 @@ void cDxr3Osd::Flush() int top = Top(); int left = Left(); + bool scaling = false; // check if we need to scale the osd if (horizontal < 720 || vertical < 576) { @@ -258,6 +259,7 @@ void cDxr3Osd::Flush() cBitmap *scaled = cScaler::scaleBitmap(bmap, width, height); scaled->Replace(*Palette); + scaling = true; bmap = scaled; } @@ -268,6 +270,12 @@ void cDxr3Osd::Flush() bmap->Clean(); } + // check if we need to free the bitmap allocated by the method + // cScaler::scaleBitmap + if (scaling) { + delete bmap; + } + #if 0 if (last->Elapsed() < cDxr3ConfigData::instance()->GetOsdFlushRate()) return; -- cgit v1.2.3