summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinson Lee <[email protected]>2009-12-05 01:38:14 -0800
committerVinson Lee <[email protected]>2009-12-05 01:38:14 -0800
commit412aeeed1c392ab5796c85287fc6ebdccd74880c (patch)
treeb58dc4d29f3c277cd5c834953d8617d60a77841c
parent6212c8103a5011e08003c8946732edad39fa74c3 (diff)
progs/samples: Fix memory leak if fopen fails in rgbtoppm.c.
-rw-r--r--progs/samples/rgbtoppm.c3
1 files changed, 2 insertions, 1 deletions
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);