From: Vinson Lee Date: Sat, 5 Dec 2009 09:38:14 +0000 (-0800) Subject: progs/samples: Fix memory leak if fopen fails in rgbtoppm.c. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=412aeeed1c392ab5796c85287fc6ebdccd74880c;p=mesa.git progs/samples: Fix memory leak if fopen fails in rgbtoppm.c. --- diff --git a/progs/samples/rgbtoppm.c b/progs/samples/rgbtoppm.c index 116d9a8cfa5..6652bb32ec1 100644 --- a/progs/samples/rgbtoppm.c +++ b/progs/samples/rgbtoppm.c @@ -86,7 +86,8 @@ static ImageRec *ImageOpen(char *fileName) exit(1); } if ((image->file = fopen(fileName, "rb")) == NULL) { - return NULL; + free(image); + return NULL; } fread(image, 1, 12, image->file);