[U-Boot] [PATCH 1/1] common: cli: avoid memory leak

Peng Fan van.freenix at gmail.com
Tue Dec 22 10:14:13 CET 2015


From: Peng Fan <peng.fan at nxp.com>

Whether CONFIG_SYS_HUSH_PARSER is defined or not, should always
check to free 'buff' to avoid memory leak.

Signed-off-by: Peng Fan <peng.fan at nxp.com>
Cc: Tom Rini <trini at konsulko.com>
Cc: Masahiro Yamada <yamada.masahiro at socionext.com>
Cc: Simon Glass <sjg at chromium.org>
---
 common/cli.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/cli.c b/common/cli.c
index fbcd339..119d282 100644
--- a/common/cli.c
+++ b/common/cli.c
@@ -103,9 +103,9 @@ int run_command_list(const char *cmd, int len, int flag)
 	 * is pretty rare.
 	 */
 	rcode = cli_simple_run_command_list(buff, flag);
+#endif
 	if (need_buff)
 		free(buff);
-#endif
 
 	return rcode;
 }
-- 
2.6.2



More information about the U-Boot mailing list