commit cf4bd0bec89d3e92f85e56c75f397df664f1714c
parent 9dc240d62f7051e7bcf1db2345e5b89906d7b18b
Author: FRIGN <dev@frign.de>
Date: Sat, 19 Jul 2014 23:28:55 +0200
Check malloc
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/imagefile2png.c b/imagefile2png.c
@@ -64,6 +64,9 @@ main(int argc, char *argv[])
/* write rows */
png_row_len = strlen("RGBA") * width * sizeof(uint8_t);
png_row = malloc(png_row_len);
+ if (!png_row) {
+ fprintf(stderr, "failed to allocate row-buffer\n");
+ }
for (i=0; i < height; ++i) {
if (fread(png_row, 1, png_row_len, stdin) != png_row_len) {