* Fix a small memory leak in the C bindings destructors.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
diff --git a/src/FTFont/FTFontGlue.cpp b/src/FTFont/FTFontGlue.cpp
index 1a0f631..ace0bdb 100644
--- a/src/FTFont/FTFontGlue.cpp
+++ b/src/FTFont/FTFontGlue.cpp
@@ -125,6 +125,7 @@ void ftglDestroyFont(FTGLfont *f)
}
f->ptr = NULL;
+ free(f);
}
// bool FTFont::Attach(const char* fontFilePath);
diff --git a/src/FTGlyph/FTGlyphGlue.cpp b/src/FTGlyph/FTGlyphGlue.cpp
index 6957d05..f894e25 100644
--- a/src/FTGlyph/FTGlyphGlue.cpp
+++ b/src/FTGlyph/FTGlyphGlue.cpp
@@ -133,6 +133,7 @@ void ftglDestroyGlyph(FTGLglyph *g)
}
g->ptr = NULL;
+ free(g);
}
// const FTPoint& FTGlyph::Render(const FTPoint& pen, int renderMode);
diff --git a/src/FTLayout/FTLayoutGlue.cpp b/src/FTLayout/FTLayoutGlue.cpp
index b4b877e..3772f36 100644
--- a/src/FTLayout/FTLayoutGlue.cpp
+++ b/src/FTLayout/FTLayoutGlue.cpp
@@ -66,23 +66,24 @@ C_TOR(ftglCreateSimpleLayout, (), FTSimpleLayout, (), LAYOUT_SIMPLE);
}
// FTLayout::~FTLayout();
-void ftglDestroyLayout(FTGLlayout *f)
+void ftglDestroyLayout(FTGLlayout *l)
{
- if(!f || !f->ptr)
+ if(!l || !l->ptr)
{
fprintf(stderr, "FTGL warning: NULL pointer in %s\n", __FUNCTION__);
return;
}
- switch(f->type)
+ switch(l->type)
{
case FTGL::LAYOUT_SIMPLE:
- delete dynamic_cast<FTSimpleLayout*>(f->ptr); break;
+ delete dynamic_cast<FTSimpleLayout*>(l->ptr); break;
default:
fprintf(stderr, "FTGL warning: %s not implemented for %d\n",
- __FUNCTION__, f->type);
+ __FUNCTION__, l->type);
}
- f->ptr = NULL;
+ l->ptr = NULL;
+ free(l);
}
// virtual void BBox(const char* string, float& llx, float& lly, float& llz, float& urx, float& ury, float& urz)