summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.vnet.ibm.com>2015-11-11 12:52:30 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-11-11 12:52:30 +1100
commit125f95edb7c1103cb4b0f6f9831e3aded9277f16 (patch)
tree5785baa08e8a27271e87bb333a04a19ca7683f38
parenta3b9e2f777649db8fe601ec5d85457b19058b6c5 (diff)
downloadblackbird-skiboot-125f95edb7c1103cb4b0f6f9831e3aded9277f16.tar.gz
blackbird-skiboot-125f95edb7c1103cb4b0f6f9831e3aded9277f16.zip
Fix resource leak on crash
Even though we're heading to abort(), it seems like some static analysis checkers still think we're leaking. So.... well, let's just make them happy and free the memory. It's harmless to do that. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--core/device.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/device.c b/core/device.c
index 483baec7..89e530f2 100644
--- a/core/device.c
+++ b/core/device.c
@@ -318,14 +318,18 @@ static struct dt_property *new_property(struct dt_node *node,
const char *name, size_t size)
{
struct dt_property *p = malloc(sizeof(*p) + size);
+ char *path;
+
if (!p) {
prerror("Failed to allocate property \"%s\" for %s of %zu bytes\n",
name, dt_get_path(node), size);
abort();
}
if (dt_find_property(node, name)) {
+ path = dt_get_path(node);
prerror("Duplicate property \"%s\" in node %s\n",
- name, dt_get_path(node));
+ name, path);
+ free(path);
abort();
}
OpenPOWER on IntegriCloud