[Skiboot] [PATCH] Fix resource leak on crash (similar to 125f95e)

Stewart Smith stewart at linux.vnet.ibm.com
Thu Nov 12 10:48:17 AEDT 2015


The error paths here are a bit suspicious anyway as we're allocating
memory in a failure path for having failed to allocate memory.
One can hope that the memory allocated to display the error is less
than the memory we attempted to allocate in the first place.

Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
---
 core/device.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/core/device.c b/core/device.c
index 89e530f26554..c5f863454983 100644
--- a/core/device.c
+++ b/core/device.c
@@ -321,8 +321,10 @@ static struct dt_property *new_property(struct dt_node *node,
 	char *path;
 
 	if (!p) {
+		path = dt_get_path(node);
 		prerror("Failed to allocate property \"%s\" for %s of %zu bytes\n",
-			name, dt_get_path(node), size);
+			name, path, size);
+		free(path);
 		abort();
 	}
 	if (dt_find_property(node, name)) {
-- 
2.1.4



More information about the Skiboot mailing list