All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/1] common: cli: avoid memory leak
@ 2015-12-22  9:14 Peng Fan
  2015-12-22  9:14 ` [U-Boot] [PATCH 1/1] common: env: initialize scalar variable Peng Fan
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Peng Fan @ 2015-12-22  9:14 UTC (permalink / raw)
  To: u-boot

From: Peng Fan <peng.fan@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@nxp.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@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

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

end of thread, other threads:[~2016-01-04 22:23 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-22  9:14 [U-Boot] [PATCH 1/1] common: cli: avoid memory leak Peng Fan
2015-12-22  9:14 ` [U-Boot] [PATCH 1/1] common: env: initialize scalar variable Peng Fan
2015-12-22  9:29   ` Wolfgang Denk
2015-12-23  3:07     ` Peng Fan
2015-12-22  9:14 ` [U-Boot] [PATCH 1/1] common: nvedit: use snprintf instead of sprintf Peng Fan
2015-12-22  9:53   ` Fabio Estevam
2015-12-22 19:40     ` Tom Rini
2015-12-23  3:00       ` Peng Fan
2015-12-22 19:11   ` Joe Hershberger
2015-12-28  4:22 ` [U-Boot] [PATCH 1/1] common: cli: avoid memory leak Simon Glass
2015-12-28  5:12   ` Peng Fan
2016-01-04 19:59     ` Tom Rini
2016-01-04 22:23 ` [U-Boot] [U-Boot,1/1] " Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.