aboutsummaryrefslogtreecommitdiff
path: root/hw/ppc
diff options
context:
space:
mode:
authorBALATON Zoltan <balaton@eik.bme.hu>2018-07-15 22:47:26 +0200
committerDavid Gibson <david@gibson.dropbear.id.au>2018-07-16 11:18:32 +1000
commit3cc702d6aad603fdbe0c83db0bf803e450a6d0b8 (patch)
tree804afc9c948113e465d93a931948bb66436b6c21 /hw/ppc
parentfd8e3381a00feb1e9878f6a3e2de11295f041f67 (diff)
sam460ex: Correct use after free error
Commit 51b0d834c changed error handling to report file name in error message but forgot to move freeing it after usage. Noticed by Coverity. Fixes: CID 1394217 Reported-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc')
-rw-r--r--hw/ppc/sam460ex.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c
index e2b7028843..0999efcc1e 100644
--- a/hw/ppc/sam460ex.c
+++ b/hw/ppc/sam460ex.c
@@ -269,11 +269,12 @@ static int sam460ex_load_device_tree(hwaddr addr,
exit(1);
}
fdt = load_device_tree(filename, &fdt_size);
- g_free(filename);
if (!fdt) {
error_report("Couldn't load dtb file `%s'", filename);
+ g_free(filename);
exit(1);
}
+ g_free(filename);
/* Manipulate device tree in memory. */