]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
sam460ex: Correct use after free error
authorBALATON Zoltan <balaton@eik.bme.hu>
Sun, 15 Jul 2018 20:47:26 +0000 (22:47 +0200)
committerDavid Gibson <david@gibson.dropbear.id.au>
Mon, 16 Jul 2018 01:18:32 +0000 (11:18 +1000)
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>
hw/ppc/sam460ex.c

index e2b7028843e6523929c9d935f0efefe3c72a89ae..0999efcc1e545a24e05c070628168bbe9a1260bf 100644 (file)
@@ -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. */