mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-13 16:27:39 -04:00
DTC: Fix memory leak on flatname.
If flatname was not referenced by the "node" structure, the reference to the allocated string is lost at function exit. We need to free it if is not used by "node". Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
1ee0ae24ea
commit
cb9241ae34
1 changed files with 4 additions and 0 deletions
|
@ -797,6 +797,10 @@ static struct node *unflatten_tree(struct inbuf *dtbuf,
|
|||
}
|
||||
} while (val != FDT_END_NODE);
|
||||
|
||||
if (node->name != flatname) {
|
||||
free(flatname);
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue