Fix memory leak: properly release each allocated element of characterBitmaps

svn path=/trunk/KDE/kdegraphics/okular/; revision=1079217
This commit is contained in:
Luigi Toscano 2010-01-23 21:28:08 +00:00
parent dd912f70a0
commit a1d64f2944
3 changed files with 19 additions and 0 deletions

View file

@ -104,6 +104,11 @@ TeXFont_PK::TeXFont_PK(TeXFontDefinition *parent)
TeXFont_PK::~TeXFont_PK()
{
//@@@ Release bitmaps
for(unsigned int i=0; i<TeXFontDefinition::max_num_of_chars_in_font; i++)
if (characterBitmaps[i] != 0) {
delete characterBitmaps[i];
characterBitmaps[i] = 0;
}
if (file != 0) {
fclose(file);

View file

@ -12,6 +12,17 @@
#include "glyph.h"
#include "kvs_debug.h"
bitmap::bitmap()
{
bits = 0;
}
bitmap::~bitmap()
{
if (bits != 0) {
delete bits;
}
}
glyph::glyph()
{

View file

@ -8,6 +8,9 @@
struct bitmap {
bitmap();
~bitmap();
// width and height in pixels
quint16 w, h;
// scan-line width in bytes