[coreboot-gerrit] Change in coreboot[master]: Coverity: Fix CID1393979

Philipp Deppenwiese (Code Review) gerrit at coreboot.org
Thu Jul 12 17:21:16 CEST 2018


Philipp Deppenwiese has submitted this change and it was merged. ( https://review.coreboot.org/27445 )

Change subject: Coverity: Fix CID1393979
......................................................................

Coverity: Fix CID1393979

Fix resource leak in dt_set_bin_prop_by_path().

Change-Id: I1c4d7e01b25847a2091ad90d2d70711beae55905
Signed-off-by: Patrick Rudolph <patrick.rudolph at 9elements.com>
Reviewed-on: https://review.coreboot.org/27445
Tested-by: build bot (Jenkins) <no-reply at coreboot.org>
Reviewed-by: Philipp Deppenwiese <zaolin.daisuki at gmail.com>
---
M src/lib/device_tree.c
1 file changed, 3 insertions(+), 0 deletions(-)

Approvals:
  build bot (Jenkins): Verified
  Philipp Deppenwiese: Looks good to me, approved



diff --git a/src/lib/device_tree.c b/src/lib/device_tree.c
index 3d44f39..00b36fd 100644
--- a/src/lib/device_tree.c
+++ b/src/lib/device_tree.c
@@ -944,6 +944,7 @@
 
 	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 @@
 	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;
 }

-- 
To view, visit https://review.coreboot.org/27445
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I1c4d7e01b25847a2091ad90d2d70711beae55905
Gerrit-Change-Number: 27445
Gerrit-PatchSet: 2
Gerrit-Owner: Patrick Rudolph <patrick.rudolph at 9elements.com>
Gerrit-Reviewer: Paul Menzel <paulepanter at users.sourceforge.net>
Gerrit-Reviewer: Philipp Deppenwiese <zaolin.daisuki at gmail.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply at coreboot.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180712/a7323b9b/attachment.html>


More information about the coreboot-gerrit mailing list