1
0
mirror of git://projects.qi-hardware.com/antorcha.git synced 2024-11-22 12:42:27 +02:00

tools/libtxt/font.c (free_image, free_font): allow NULL pointer

This commit is contained in:
Werner Almesberger 2012-06-30 12:59:50 -03:00
parent 350283375c
commit 6ffcd815f9

View File

@ -152,8 +152,10 @@ struct image *load_image(const char *name, const char **error)
void free_image(struct image *img) void free_image(struct image *img)
{ {
free(img->data); if (img) {
free(img); free(img->data);
free(img);
}
} }
@ -238,8 +240,10 @@ struct font *make_font(struct image *img, const char **error)
void free_font(struct font *font) void free_font(struct font *font)
{ {
free_image(font->img); if (font) {
free(font); free_image(font->img);
free(font);
}
} }