summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/device_tree.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/lib/device_tree.c b/src/lib/device_tree.c
index a5021ca8fd..ed878a25a3 100644
--- a/src/lib/device_tree.c
+++ b/src/lib/device_tree.c
@@ -259,11 +259,13 @@ struct device_tree *fdt_unflatten(const void *blob)
if (magic != FDT_HEADER_MAGIC) {
printk(BIOS_DEBUG, "Invalid device tree magic %#.8x!\n", magic);
+ free(tree);
return NULL;
}
if (last_comp_version > FDT_SUPPORTED_VERSION) {
printk(BIOS_DEBUG, "Unsupported device tree version %u(>=%u)\n",
version, last_comp_version);
+ free(tree);
return NULL;
}
if (version > FDT_SUPPORTED_VERSION)