Fix memory leak in rtext LoadFontFromImage method
Fix for [rtext] Memory leak at LoadFontFromImage when failing to compute spacing's
This commit is contained in:
parent
4c1dc51a6f
commit
2be2d73afa
1 changed files with 4 additions and 1 deletions
|
|
@ -438,7 +438,10 @@ Font LoadFontFromImage(Image image, Color key, int firstChar)
|
||||||
if (!COLOR_EQUAL(pixels[y*image.width + x], key)) break;
|
if (!COLOR_EQUAL(pixels[y*image.width + x], key)) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((x == 0) || (y == 0)) return font; // Security check
|
if ((x == 0) || (y == 0)) {
|
||||||
|
UnloadImageColors(pixels); // Unload pixel colors to prevent memory leak
|
||||||
|
return font; // Security check
|
||||||
|
}
|
||||||
|
|
||||||
charSpacing = x;
|
charSpacing = x;
|
||||||
lineSpacing = y;
|
lineSpacing = y;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue