summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2012-03-13 15:38:00 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2012-03-13 15:38:00 +0100
commitd62f7104138a48f77efd385cc2a8435515addd33 (patch)
tree845af440b9036ca69fdbcb7201bca5aec2cb88d7
parent2781c337b18f80fc7e9a16c65064c4ef2a47b147 (diff)
downloadvdr-d62f7104138a48f77efd385cc2a8435515addd33.tar.gz
vdr-d62f7104138a48f77efd385cc2a8435515addd33.tar.bz2
Fixed a memory leak in cSubtitleRegion::UpdateTextData()
-rw-r--r--HISTORY1
-rw-r--r--dvbsubtitle.c12
2 files changed, 7 insertions, 6 deletions
diff --git a/HISTORY b/HISTORY
index 7067c91b..6a173bd8 100644
--- a/HISTORY
+++ b/HISTORY
@@ -7042,3 +7042,4 @@ Video Disk Recorder Revision History
the previous value of 25.75 MB/min is taken.
- No longer using GetFont() (which is not thread safe) in the 'osddemo' plugin.
- No longer using GetFont() (which is not thread safe) in cSubtitleRegion::UpdateTextData().
+- Fixed a memory leak in cSubtitleRegion::UpdateTextData().
diff --git a/dvbsubtitle.c b/dvbsubtitle.c
index a623df2f..ca3a6929 100644
--- a/dvbsubtitle.c
+++ b/dvbsubtitle.c
@@ -7,7 +7,7 @@
* Original author: Marco Schluessler <marco@lordzodiac.de>
* With some input from the "subtitle plugin" by Pekka Virtanen <pekka.virtanen@sci.fi>
*
- * $Id: dvbsubtitle.c 2.29 2012/03/13 15:30:47 kls Exp $
+ * $Id: dvbsubtitle.c 2.30 2012/03/13 15:37:03 kls Exp $
*/
@@ -492,12 +492,12 @@ void cSubtitleRegion::UpdateTextData(cSubtitleClut *Clut)
for (cSubtitleObject *so = objects.First(); so && palette; so = objects.Next(so)) {
if (Utf8StrLen(so->TextData()) > 0) {
cFont *font = cFont::CreateFont(Setup.FontOsd, Setup.FontOsdSize);
- cBitmap *tmp = new cBitmap(font->Width(so->TextData()), font->Height(), Depth());
+ cBitmap tmp(font->Width(so->TextData()), font->Height(), Depth());
double factor = (double)lineHeight / font->Height();
- tmp->DrawText(0, 0, so->TextData(), palette->Color(so->ForegroundPixelCode()), palette->Color(so->BackgroundPixelCode()), font);
- tmp = tmp->Scaled(factor, factor, true);
- DrawBitmap(so->X(), so->Y(), *tmp);
- DELETENULL(tmp);
+ tmp.DrawText(0, 0, so->TextData(), palette->Color(so->ForegroundPixelCode()), palette->Color(so->BackgroundPixelCode()), font);
+ cBitmap *scaled = tmp.Scaled(factor, factor, true);
+ DrawBitmap(so->X(), so->Y(), *scaled);
+ delete scaled;
delete font;
}
}