summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorPatrick Rudolph <patrick.rudolph@9elements.com>2018-07-11 13:53:04 +0200
committerPhilipp Deppenwiese <zaolin.daisuki@gmail.com>2018-07-12 15:21:10 +0000
commit679d624fae6d96e53264c2b6f0dd6216636fab15 (patch)
treefaffc83604b10654589151ac633e8c9ae9f141d5 /src/lib
parent3ec008bf40613776173251652c8c33d563299d73 (diff)
downloadcoreboot-679d624fae6d96e53264c2b6f0dd6216636fab15.tar.xz
Coverity: Fix CID1393979
Fix resource leak in dt_set_bin_prop_by_path(). Change-Id: I1c4d7e01b25847a2091ad90d2d70711beae55905 Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-on: https://review.coreboot.org/27445 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/device_tree.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/lib/device_tree.c b/src/lib/device_tree.c
index 3d44f39375..00b36fdb4a 100644
--- a/src/lib/device_tree.c
+++ b/src/lib/device_tree.c
@@ -944,6 +944,7 @@ int dt_set_bin_prop_by_path(struct device_tree *tree, const char *path,
prop_name = strrchr(path_copy, '/');
if (!prop_name) {
+ free(path_copy);
printk(BIOS_ERR, "Path %s does not include '/'\n", path);
return 1;
}
@@ -956,10 +957,12 @@ int dt_set_bin_prop_by_path(struct device_tree *tree, const char *path,
if (!dt_node) {
printk(BIOS_ERR, "Failed to %s %s in the device tree\n",
create ? "create" : "find", path_copy);
+ free(path_copy);
return 1;
}
dt_add_bin_prop(dt_node, prop_name, data, data_size);
+ free(path_copy);
return 0;
}