diff options
author | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-11-11 12:52:30 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-11-11 12:52:30 +1100 |
commit | 125f95edb7c1103cb4b0f6f9831e3aded9277f16 (patch) | |
tree | 5785baa08e8a27271e87bb333a04a19ca7683f38 | |
parent | a3b9e2f777649db8fe601ec5d85457b19058b6c5 (diff) | |
download | skiboot-125f95edb7c1103cb4b0f6f9831e3aded9277f16.zip skiboot-125f95edb7c1103cb4b0f6f9831e3aded9277f16.tar.gz skiboot-125f95edb7c1103cb4b0f6f9831e3aded9277f16.tar.bz2 |
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.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/device.c b/core/device.c index 483baec..89e530f 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(); } |