[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 02/12] microvm: fix memory leak in microvm_fix_kernel_cmdline
From: |
Paolo Bonzini |
Subject: |
[PULL 02/12] microvm: fix memory leak in microvm_fix_kernel_cmdline |
Date: |
Tue, 19 Nov 2019 17:08:38 +0100 |
From: Sergio Lopez <address@hidden>
In microvm_fix_kernel_cmdline(), fw_cfg_modify_string() is duplicating
cmdline instead of taking ownership of it. Free it afterwards to avoid
leaking it.
Reported-by: Coverity (CID 1407218)
Suggested-by: Peter Maydell <address@hidden>
Signed-off-by: Sergio Lopez <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/i386/microvm.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
index 8aacd6c..def37e6 100644
--- a/hw/i386/microvm.c
+++ b/hw/i386/microvm.c
@@ -331,6 +331,8 @@ static void microvm_fix_kernel_cmdline(MachineState
*machine)
fw_cfg_modify_i32(x86ms->fw_cfg, FW_CFG_CMDLINE_SIZE, strlen(cmdline) + 1);
fw_cfg_modify_string(x86ms->fw_cfg, FW_CFG_CMDLINE_DATA, cmdline);
+
+ g_free(cmdline);
}
static void microvm_machine_state_init(MachineState *machine)
--
1.8.3.1
- [PULL 00/12] Misc patches for QEMU 4.2-rc, Paolo Bonzini, 2019/11/19
- [PULL 02/12] microvm: fix memory leak in microvm_fix_kernel_cmdline,
Paolo Bonzini <=
- [PULL 01/12] scripts: Detect git worktrees for get_maintainer.pl --git, Paolo Bonzini, 2019/11/19
- [PULL 03/12] target/i386: add PSCHANGE_NO bit for the ARCH_CAPABILITIES MSR, Paolo Bonzini, 2019/11/19
- [PULL 04/12] target/i386: Export TAA_NO bit to guests, Paolo Bonzini, 2019/11/19
- [PULL 05/12] hw/i386: Fix compiler warning when CONFIG_IDE_ISA is disabled, Paolo Bonzini, 2019/11/19
- [PULL 06/12] vfio: vfio-pci requires EDID, Paolo Bonzini, 2019/11/19
- [PULL 07/12] docs/microvm.rst: fix alignment in "Limitations", Paolo Bonzini, 2019/11/19
- [PULL 08/12] docs/microvm.rst: add instructions for shutting down the guest, Paolo Bonzini, 2019/11/19
- [PULL 09/12] hw/i386: Move save_tsc_khz from PCMachineClass to X86MachineClass, Paolo Bonzini, 2019/11/19
- [PULL 10/12] scsi: deprecate scsi-disk, Paolo Bonzini, 2019/11/19
- [PULL 11/12] Revert "mc146818rtc: fix timer interrupt reinjection", Paolo Bonzini, 2019/11/19