提交 5d8fae79 编写于 作者: P Peng Fan 提交者: Marek Vasut

dfu: avoid memory leak

When dfu_fill_entity fail, need to free dfu to avoid memory leak.

Reported by Coverity:
"
Resource leak (RESOURCE_LEAK)
leaked_storage: Variable dfu going out of scope leaks the storage
it points to.
"
Signed-off-by: NPeng Fan <van.freenix@gmail.com>
Cc: "Łukasz Majewski" <l.majewski@samsung.com>
Cc: Marek Vasut <marex@denx.de>
上级 2bf352f0
......@@ -468,8 +468,10 @@ int dfu_config_entities(char *env, char *interface, char *devstr)
s = strsep(&env, ";");
ret = dfu_fill_entity(&dfu[i], s, alt_num_cnt, interface,
devstr);
if (ret)
if (ret) {
free(dfu);
return -1;
}
list_add_tail(&dfu[i].list, &dfu_list);
alt_num_cnt++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册