mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 01/12] scripts: imx-image: Fix resource leak
@ 2014-04-12  8:10 Alexander Shiyan
  2014-04-12  8:10 ` [PATCH 02/12] gui: " Alexander Shiyan
                   ` (11 more replies)
  0 siblings, 12 replies; 16+ messages in thread
From: Alexander Shiyan @ 2014-04-12  8:10 UTC (permalink / raw)
  To: barebox

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 scripts/imx/imx-image.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/scripts/imx/imx-image.c b/scripts/imx/imx-image.c
index 1d935be..f87f4d2 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 out_parse;
 				}
 				break;
 			}
@@ -567,11 +567,14 @@ static int parse_config(const char *filename)
 
 		if (ret == -ENOENT) {
 			fprintf(stderr, "no such command: %s\n", argv[0]);
-			return ret;
+			break;
 		}
 	}
 
-	return 0;
+out_parse:
+	fclose(f);
+
+	return ret;
 }
 
 static int xread(int fd, void *buf, int len)
-- 
1.8.3.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2014-04-23  9:56 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-12  8:10 [PATCH 01/12] scripts: imx-image: Fix resource leak Alexander Shiyan
2014-04-12  8:10 ` [PATCH 02/12] gui: " Alexander Shiyan
2014-04-12  8:10 ` [PATCH 03/12] lzo: Remove unused variable Alexander Shiyan
2014-04-12  8:10 ` [PATCH 04/12] ubifs: " Alexander Shiyan
2014-04-12  8:10 ` [PATCH 05/12] commands/mount: Return real error code if "mount" fail Alexander Shiyan
2014-04-23  9:47   ` Sascha Hauer
2014-04-12  8:10 ` [PATCH 06/12] commands/uimage: Fix error printing Alexander Shiyan
2014-04-12  8:11 ` [PATCH 07/12] commands/umount: Return real error code if "umount" fail Alexander Shiyan
2014-04-23  9:54   ` Sascha Hauer
2014-04-12  8:11 ` [PATCH 08/12] commands/usbserial: Remove unused variable Alexander Shiyan
2014-04-12  8:11 ` [PATCH 09/12] ata: pata-imx: " Alexander Shiyan
2014-04-12  8:11 ` [PATCH 10/12] imx_keypad: Fix error handling Alexander Shiyan
2014-04-23  9:54   ` Sascha Hauer
2014-04-12  8:11 ` [PATCH 11/12] mtd: partition: Remove unused variable Alexander Shiyan
2014-04-12  8:11 ` [PATCH 12/12] mtd: nand: bbt: " Alexander Shiyan
2014-04-23  9:56 ` [PATCH 01/12] scripts: imx-image: Fix resource leak Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox