mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 22:51:37 +00:00
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: Peng Fan <van.freenix@gmail.com> Cc: "Łukasz Majewski" <l.majewski@samsung.com> Cc: Marek Vasut <marex@denx.de>
This commit is contained in:
parent
2bf352f0c1
commit
5d8fae7916
1 changed files with 3 additions and 1 deletions
|
@ -468,8 +468,10 @@ int dfu_config_entities(char *env, char *interface, char *devstr)
|
||||||
s = strsep(&env, ";");
|
s = strsep(&env, ";");
|
||||||
ret = dfu_fill_entity(&dfu[i], s, alt_num_cnt, interface,
|
ret = dfu_fill_entity(&dfu[i], s, alt_num_cnt, interface,
|
||||||
devstr);
|
devstr);
|
||||||
if (ret)
|
if (ret) {
|
||||||
|
free(dfu);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
list_add_tail(&dfu[i].list, &dfu_list);
|
list_add_tail(&dfu[i].list, &dfu_list);
|
||||||
alt_num_cnt++;
|
alt_num_cnt++;
|
||||||
|
|
Loading…
Add table
Reference in a new issue