Skip to content

Commit

Permalink
Font: Memory leak
Browse files Browse the repository at this point in the history
If HAVE_FREETYPE macro is not defined, the memory allocated in buffer is not freed
  • Loading branch information
roiqd03 committed May 8, 2024
1 parent 949c2a5 commit 790ec36
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Components/Overlay/src/OgreFont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,18 @@ namespace Ogre
// Advance a column
if(width)
l += (width + char_spacer);

#ifndef HAVE_FREETYPE
if (buffer != NULL)
{
int ix0, iy0, ix1, iy1;
stbtt__bitmap gbm;
stbtt_GetGlyphBitmapBoxSubpixel(&font, stbtt_FindGlyphIndex(&font, cp), scale, scale, 0.0f, 0.0f, &ix0, &iy0, &ix1, &iy1);
gbm.w = (ix1 - ix0);
gbm.h = (iy1 - iy0);
STBTT_free(buffer, gbm.w * gbm.h);
}
#endif
}
}
#ifdef HAVE_FREETYPE
Expand Down

0 comments on commit 790ec36

Please sign in to comment.