提交 87a8ca98 编写于 作者: S Sam Protsenko 提交者: Marek Vasut

dfu: Fix memory leak in dfu_init_env_entities()

In case of error in dfu_init_env_entities(), env_bkp will leak. Fix it
by providing single return path.
Signed-off-by: NSam Protsenko <semen.protsenko@linaro.org>
上级 feaa7856
......@@ -56,7 +56,7 @@ int dfu_init_env_entities(char *interface, char *devstr)
{
const char *str_env;
char *env_bkp;
int ret;
int ret = 0;
#ifdef CONFIG_SET_DFU_ALT_INFO
set_dfu_alt_info(interface, devstr);
......@@ -71,11 +71,12 @@ int dfu_init_env_entities(char *interface, char *devstr)
ret = dfu_config_entities(env_bkp, interface, devstr);
if (ret) {
pr_err("DFU entities configuration failed!\n");
return ret;
goto done;
}
done:
free(env_bkp);
return 0;
return ret;
}
static unsigned char *dfu_buf;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册