mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-19 05:31:32 +00:00
core: ofnode: Fix mem leak in error path
A newly created property is currently not freed if a name could not be
allocated. This patch fixes the resulting memory leak in the error
patch.
Reported-by: Coverity (CID: 184085)
Fixes: e369e58df7
("core: Add functions to set properties in live-tree")
Signed-off-by: Mario Six <mario.six@gdsys.cc>
This commit is contained in:
parent
ab88bd2b6a
commit
205dd5afe5
1 changed files with 3 additions and 1 deletions
|
@ -831,8 +831,10 @@ int ofnode_write_prop(ofnode node, const char *propname, int len,
|
|||
return -ENOMEM;
|
||||
|
||||
new->name = strdup(propname);
|
||||
if (!new->name)
|
||||
if (!new->name) {
|
||||
free(new);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
new->value = (void *)value;
|
||||
new->length = len;
|
||||
|
|
Loading…
Add table
Reference in a new issue