summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Fan <peng.fan@nxp.com>2015-12-22 17:14:13 +0800
committerguoyin.chen <guoyin.chen@freescale.com>2016-03-04 15:53:37 +0800
commitf4a21b2f99cf8d977d9a0b270e4c997f623e74e9 (patch)
tree58e8363e8b36a99f5e3173e0e6f99e51a4714445
parentac2195a85d7af268ee2a8664ce41afd5fa55cbcf (diff)
downloadu-boot-imx-f4a21b2f99cf8d977d9a0b270e4c997f623e74e9.zip
u-boot-imx-f4a21b2f99cf8d977d9a0b270e4c997f623e74e9.tar.gz
u-boot-imx-f4a21b2f99cf8d977d9a0b270e4c997f623e74e9.tar.bz2
common: cli: avoid memory leak
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> (cherry picked from commit 09a788624dbe32aeeb0d74c97c0965303eb96d8c)
-rw-r--r--common/cli.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/cli.c b/common/cli.c
index 075ae9d..5bfb180 100644
--- a/common/cli.c
+++ b/common/cli.c
@@ -102,9 +102,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;
}