diff options
Diffstat (limited to 'src/image.c')
-rw-r--r-- | src/image.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/image.c b/src/image.c index 47bc94c..626ffa7 100644 --- a/src/image.c +++ b/src/image.c @@ -21,6 +21,7 @@ #include "image.h" +#include <assert.h> #include <stdlib.h> #include <stdio.h> @@ -42,6 +43,8 @@ image_new(const char *file_name) { struct image *image; + assert(file_name && *file_name); + image = calloc(1, sizeof(*image)); if (!image) { error(_("Cannot allocate memory for image object")); @@ -87,6 +90,10 @@ image_render(struct image *image, const struct text *text, png_bytepp rows; size_t i; + assert(image); + assert(text); + assert(font); + width = text_get_width(text) * font_get_width(font); height = text_get_height(text) * font_get_height(font); @@ -116,6 +123,8 @@ image_destroy(struct image **image_p) { struct image *image; + assert(image_p && *image_p); + image = *image_p; if (image->fp) { |