From: Lucas Stach <dev@lynxeye.de>
To: barebox@lists.infradead.org
Subject: [PATCH 3/5] imx-image: don't leak file handle
Date: Mon, 21 Apr 2014 22:15:24 +0200 [thread overview]
Message-ID: <1398111326-21783-3-git-send-email-dev@lynxeye.de> (raw)
In-Reply-To: <1398111326-21783-1-git-send-email-dev@lynxeye.de>
Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
scripts/imx/imx-image.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/scripts/imx/imx-image.c b/scripts/imx/imx-image.c
index 1d935be7561d..f4890c44d7fa 100644
--- a/scripts/imx/imx-image.c
+++ b/scripts/imx/imx-image.c
@@ -528,7 +528,7 @@ static int parse_config(const char *filename)
int lineno = 0;
char *line = NULL, *tmp;
char *argv[MAXARGS];
- int nargs, i, ret;
+ int nargs, i, ret = 0;
f = fopen(filename, "r");
if (!f) {
@@ -559,7 +559,7 @@ static int parse_config(const char *filename)
if (ret) {
fprintf(stderr, "error in line %d: %s\n",
lineno, strerror(-ret));
- return ret;
+ goto cleanup;
}
break;
}
@@ -567,11 +567,13 @@ static int parse_config(const char *filename)
if (ret == -ENOENT) {
fprintf(stderr, "no such command: %s\n", argv[0]);
- return ret;
+ goto cleanup;
}
}
- return 0;
+cleanup:
+ fclose(f);
+ return ret;
}
static int xread(int fd, void *buf, int len)
--
1.9.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2014-04-21 20:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-21 20:15 [PATCH 1/5] treewide: fix signedness mixups in printf format specifiers Lucas Stach
2014-04-21 20:15 ` [PATCH 2/5] ARM: at91: add missing break Lucas Stach
2014-04-22 1:14 ` Bo Shen
2014-04-21 20:15 ` Lucas Stach [this message]
2014-04-21 20:15 ` [PATCH 4/5] video: displaytimings: remove two broken error messages Lucas Stach
2014-04-21 20:15 ` [PATCH 5/5] video: imx-ipu-v3: fix possible NULL ptr dereference Lucas Stach
2014-04-21 20:43 ` Fabio Estevam
2014-04-23 7:20 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1398111326-21783-3-git-send-email-dev@lynxeye.de \
--to=dev@lynxeye.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox