mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] scripts/kwbimage: Fix resource leak in image_create()
@ 2014-02-03 18:50 Alexander Shiyan
  2014-02-03 18:50 ` [PATCH 2/2] scripts/kwbimage: Fix resource leak in image_create_payload() Alexander Shiyan
  2014-02-04  7:21 ` [PATCH 1/2] scripts/kwbimage: Fix resource leak in image_create() Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Alexander Shiyan @ 2014-02-03 18:50 UTC (permalink / raw)
  To: barebox

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 scripts/kwbimage.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/kwbimage.c b/scripts/kwbimage.c
index cd87456..c085d4d 100644
--- a/scripts/kwbimage.c
+++ b/scripts/kwbimage.c
@@ -1343,6 +1343,7 @@ static int image_create(const char *input, const char *output,
 	rewind(fcfg);
 
 	ret = image_create_config_parse(fcfg, image_cfg, &cfgn);
+	fclose(fcfg);
 	if (ret) {
 		free(image_cfg);
 		return -1;
-- 
1.8.3.2


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

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

* [PATCH 2/2] scripts/kwbimage: Fix resource leak in image_create_payload()
  2014-02-03 18:50 [PATCH 1/2] scripts/kwbimage: Fix resource leak in image_create() Alexander Shiyan
@ 2014-02-03 18:50 ` Alexander Shiyan
  2014-02-04  7:21 ` [PATCH 1/2] scripts/kwbimage: Fix resource leak in image_create() Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Alexander Shiyan @ 2014-02-03 18:50 UTC (permalink / raw)
  To: barebox

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

diff --git a/scripts/kwbimage.c b/scripts/kwbimage.c
index c085d4d..f8abeb1 100644
--- a/scripts/kwbimage.c
+++ b/scripts/kwbimage.c
@@ -701,18 +701,18 @@ static int image_create_payload(void *payload_start, size_t payloadsz,
 	if (ret < 0) {
 		fprintf(stderr, "Cannot stat payload file %s\n",
 			payload_filename);
+		fclose(payload);
 		return ret;
 	}
 
 	ret = fread(payload_start, s.st_size, 1, payload);
+	fclose(payload);
 	if (ret != 1) {
 		fprintf(stderr, "Cannot read payload file %s\n",
 			payload_filename);
 		return -1;
 	}
 
-	fclose(payload);
-
 	*payload_checksum = image_checksum32(payload_start, payloadsz);
 	return 0;
 }
-- 
1.8.3.2


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

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

* Re: [PATCH 1/2] scripts/kwbimage: Fix resource leak in image_create()
  2014-02-03 18:50 [PATCH 1/2] scripts/kwbimage: Fix resource leak in image_create() Alexander Shiyan
  2014-02-03 18:50 ` [PATCH 2/2] scripts/kwbimage: Fix resource leak in image_create_payload() Alexander Shiyan
@ 2014-02-04  7:21 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2014-02-04  7:21 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: barebox

On Mon, Feb 03, 2014 at 10:50:49PM +0400, Alexander Shiyan wrote:
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>

Applied both, thanks

Sascha

> ---
>  scripts/kwbimage.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/scripts/kwbimage.c b/scripts/kwbimage.c
> index cd87456..c085d4d 100644
> --- a/scripts/kwbimage.c
> +++ b/scripts/kwbimage.c
> @@ -1343,6 +1343,7 @@ static int image_create(const char *input, const char *output,
>  	rewind(fcfg);
>  
>  	ret = image_create_config_parse(fcfg, image_cfg, &cfgn);
> +	fclose(fcfg);
>  	if (ret) {
>  		free(image_cfg);
>  		return -1;
> -- 
> 1.8.3.2
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

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

end of thread, other threads:[~2014-02-04  7:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-03 18:50 [PATCH 1/2] scripts/kwbimage: Fix resource leak in image_create() Alexander Shiyan
2014-02-03 18:50 ` [PATCH 2/2] scripts/kwbimage: Fix resource leak in image_create_payload() Alexander Shiyan
2014-02-04  7:21 ` [PATCH 1/2] scripts/kwbimage: Fix resource leak in image_create() Sascha Hauer

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