mirror of
git://projects.qi-hardware.com/antorcha.git
synced 2024-11-01 07:17:31 +02:00
tools/libtxt/font.c (free_image, free_font): allow NULL pointer
This commit is contained in:
parent
350283375c
commit
6ffcd815f9
@ -152,9 +152,11 @@ struct image *load_image(const char *name, const char **error)
|
|||||||
|
|
||||||
void free_image(struct image *img)
|
void free_image(struct image *img)
|
||||||
{
|
{
|
||||||
|
if (img) {
|
||||||
free(img->data);
|
free(img->data);
|
||||||
free(img);
|
free(img);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ----- Font generation --------------------------------------------------- */
|
/* ----- Font generation --------------------------------------------------- */
|
||||||
@ -238,9 +240,11 @@ struct font *make_font(struct image *img, const char **error)
|
|||||||
|
|
||||||
void free_font(struct font *font)
|
void free_font(struct font *font)
|
||||||
{
|
{
|
||||||
|
if (font) {
|
||||||
free_image(font->img);
|
free_image(font->img);
|
||||||
free(font);
|
free(font);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ----- Drawing on a canvas ----------------------------------------------- */
|
/* ----- Drawing on a canvas ----------------------------------------------- */
|
||||||
|
Loading…
Reference in New Issue
Block a user