diff options
| author | raysan5 <[email protected]> | 2018-05-21 18:57:54 +0200 |
|---|---|---|
| committer | raysan5 <[email protected]> | 2018-05-21 18:57:54 +0200 |
| commit | 559b9b8cc36883670e5591fdc03cee2f0452fdf1 (patch) | |
| tree | 568be81868ff850f8e25d33fce627c53dc861c6c /src | |
| parent | 44181baf0472675a5474c14925dff678c0c1773a (diff) | |
| download | raylib-559b9b8cc36883670e5591fdc03cee2f0452fdf1.tar.gz raylib-559b9b8cc36883670e5591fdc03cee2f0452fdf1.zip | |
Corrected possible memory leak
Diffstat (limited to 'src')
| -rw-r--r-- | src/text.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -311,6 +311,7 @@ Font LoadFontEx(const char *fileName, int fontSize, int charsCount, int *fontCha { Font spriteFont = { 0 }; int totalChars = 95; // Default charset [32..126] + bool fontCharsLoaded = false; #if defined(SUPPORT_FILEFORMAT_TTF) if (IsFileExtension(fileName, ".ttf")) @@ -321,9 +322,12 @@ Font LoadFontEx(const char *fileName, int fontSize, int charsCount, int *fontCha { fontChars = (int *)malloc(totalChars*sizeof(int)); for (int i = 0; i < totalChars; i++) fontChars[i] = i + 32; // Default first character: SPACE[32] + fontCharsLoaded = true; } spriteFont = LoadTTF(fileName, fontSize, totalChars, fontChars); + + if (fontCharsLoaded) free(fontChars); } #endif |
