From da109ff66b42be2975ed5ee44e7926b0837320e1 Mon Sep 17 00:00:00 2001 From: Stewart Smith Date: Thu, 12 Nov 2015 09:21:23 +1100 Subject: Fix resource leak on crash (similar to 125f95e) 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 --- core/device.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'core/device.c') diff --git a/core/device.c b/core/device.c index 89e530f..c5f8634 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)) { -- cgit v1.1