]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
ppc/amigaone: Free allocated struct
authorBALATON Zoltan <balaton@eik.bme.hu>
Wed, 22 Oct 2025 21:07:47 +0000 (23:07 +0200)
committerHarsh Prateek Bora <harshpb@linux.ibm.com>
Thu, 23 Oct 2025 12:07:34 +0000 (17:37 +0530)
In create_bd_info function a bd_info struct is allocated but never
freed. Mark it g_autofree to avoid leaking it.

Fixes: 34f053d86b (ppc/amigaone: Add kernel and initrd support)
Resolves: Coverity CID 1641398
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
Link: https://lore.kernel.org/qemu-devel/20251022211649.9A09E5972E5@zero.eik.bme.hu
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
hw/ppc/amigaone.c

index 12279f42bc9644de4be937009d2fbd814684ae38..47fb016b4aa694dad3bf643b774a6ec27e5a57b3 100644 (file)
@@ -221,7 +221,7 @@ struct bd_info {
 
 static void create_bd_info(hwaddr addr, ram_addr_t ram_size)
 {
-    struct bd_info *bd = g_new0(struct bd_info, 1);
+    g_autofree struct bd_info *bd = g_new0(struct bd_info, 1);
 
     bd->bi_memsize =    cpu_to_be32(ram_size);
     bd->bi_flashstart = cpu_to_be32(PROM_ADDR);