mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] bootm: Free allocated fdt buffer in error path
@ 2016-02-17 18:45 Harald Welte
  2016-02-18 11:59 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Harald Welte @ 2016-02-17 18:45 UTC (permalink / raw)
  To: barebox

It seems like there is a memory leak in an error path of
bootm_open_oftree_uimage() where the memory allocated for the fdt is not
released again.

Signed-off-by: Harald Welte <laforge@gnumonks.org>
---
 common/bootm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/common/bootm.c b/common/bootm.c
index 052cffa..7d00f8e 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -288,6 +288,7 @@ static int bootm_open_oftree_uimage(struct image_data *data, size_t *size,
 	if (ft != filetype_oftree) {
 		printf("%s is not an oftree but %s\n",
 			data->oftree_file, file_type_to_string(ft));
+		free(*fdt);
 		return -EINVAL;
 	}
 
-- 
2.7.0


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

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

* Re: [PATCH] bootm: Free allocated fdt buffer in error path
  2016-02-17 18:45 [PATCH] bootm: Free allocated fdt buffer in error path Harald Welte
@ 2016-02-18 11:59 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2016-02-18 11:59 UTC (permalink / raw)
  To: Harald Welte; +Cc: barebox

On Wed, Feb 17, 2016 at 07:45:24PM +0100, Harald Welte wrote:
> It seems like there is a memory leak in an error path of
> bootm_open_oftree_uimage() where the memory allocated for the fdt is not
> released again.
> 
> Signed-off-by: Harald Welte <laforge@gnumonks.org>
> ---
>  common/bootm.c | 1 +
>  1 file changed, 1 insertion(+)

Applied, thanks

Sascha

-- 
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] 2+ messages in thread

end of thread, other threads:[~2016-02-18 12:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-17 18:45 [PATCH] bootm: Free allocated fdt buffer in error path Harald Welte
2016-02-18 11:59 ` Sascha Hauer

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