diff options
author | Vinson Lee <vlee@vmware.com> | 2009-12-05 01:38:14 -0800 |
---|---|---|
committer | Vinson Lee <vlee@vmware.com> | 2009-12-05 01:38:14 -0800 |
commit | 412aeeed1c392ab5796c85287fc6ebdccd74880c (patch) | |
tree | b58dc4d29f3c277cd5c834953d8617d60a77841c | |
parent | 6212c8103a5011e08003c8946732edad39fa74c3 (diff) |
progs/samples: Fix memory leak if fopen fails in rgbtoppm.c.
-rw-r--r-- | progs/samples/rgbtoppm.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/progs/samples/rgbtoppm.c b/progs/samples/rgbtoppm.c index 116d9a8cfa5b..6652bb32ec1e 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); |