From 48779e501810c5046ff8af7b9cf9c99bec2928a1 Mon Sep 17 00:00:00 2001 From: "Gabriel L. Somlo" Date: Mon, 8 Jun 2015 14:10:45 -0400 Subject: fw_cfg: fix FW_CFG_BOOT_DEVICE update on ppc and sparc On ppc, sparc, and sparc64, the value of the FW_CFG_BOOT_DEVICE 16bit fw_cfg entry is repeatedly modified from a series of callbacks, which currently results in the previous value's dynamically allocated memory being leaked. This patch switches updating to the new fw_cfg_modify_i16() call, which does not cause memory leaks. Signed-off-by: Gabriel Somlo Signed-off-by: Gerd Hoffmann --- hw/ppc/mac_newworld.c | 2 +- hw/ppc/mac_oldworld.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'hw/ppc') diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index a365bf9..0f3e341 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -119,7 +119,7 @@ static const MemoryRegionOps unin_ops = { static void fw_cfg_boot_set(void *opaque, const char *boot_device, Error **errp) { - fw_cfg_add_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]); + fw_cfg_modify_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]); } static uint64_t translate_kernel_address(void *opaque, uint64_t addr) diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index f26133d..99879dd 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -52,7 +52,7 @@ static void fw_cfg_boot_set(void *opaque, const char *boot_device, Error **errp) { - fw_cfg_add_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]); + fw_cfg_modify_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]); } static uint64_t translate_kernel_address(void *opaque, uint64_t addr) -- cgit v1.1