Fix a potential memory leak bug in write_boot_rom() (v6.2.0).
From:
wliang
Subject:
Fix a potential memory leak bug in write_boot_rom() (v6.2.0).
Date:
Wed, 23 Feb 2022 22:39:23 +0800 (GMT+08:00)
Hi all,
I find a memory leak bug in QEMU 6.2.0, which is in write_boot_rom()(./hw/arm/aspeed.c).
Specifically, at line 276, a memory chunk is allocated with g_new0() and assigned to the variable 'storage'. However, if the branch takes true at line 277, there will be only an error report at line 278 but not a free operation for 'storage' before function returns. As a result, a memory leak bug is triggered.