X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=contrib%2Fgregbook%2Freadppm.c;h=7fefc3943ec47a1df394efbc1c1e631dba8e8934;hb=361fb099aa967c1618d8071268abab395e67e86a;hp=be9a56d95fd2a350df9b1593d7af62279646cb52;hpb=5ab0f6df7ecb95c9b816ece7a88a8df92b0cb2af;p=platform%2Fupstream%2Flibpng.git diff --git a/contrib/gregbook/readppm.c b/contrib/gregbook/readppm.c index be9a56d..7fefc39 100644 --- a/contrib/gregbook/readppm.c +++ b/contrib/gregbook/readppm.c @@ -163,8 +163,12 @@ uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes) /* now we can go ahead and just read the whole image */ - fread(image_data, 1L, rowbytes*height, saved_infile); - + if (fread(image_data, 1L, rowbytes*height, saved_infile) < + rowbytes*height) { + free (image_data); + image_data = NULL; + return NULL; + } return image_data; }