Re: [PATCH] qemu: fix memleaks in qemuDomainAttachDeviceLive()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/13/20 11:39 AM, Jin Yan wrote:
 From e46e168f9767b8b291f23217fc7a62163c82eaf8 Mon Sep 17 00:00:00 2001
From: Jin Yan <jinyan12@xxxxxxxxxx>
Date: Tue, 7 Jul 2020 21:58:52 +0800
Subject: [PATCH] qemu: fix memleaks in qemuDomainAttachDeviceLive()

During disk hotplugging, qemuDomainAttachDeviceLive() add the new
disk to the device list of the VM object. However, hotplugging
cdroms and floppies only updates the src variable of the original
disk device, so the newly generated disk object needs to be released.

Signed-off-by: Jin Yan <jinyan12@xxxxxxxxxx>
---
  src/qemu/qemu_hotplug.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 3954ad1109..40092b499d 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1115,6 +1115,7 @@ qemuDomainAttachDeviceDiskLive(virQEMUDriverPtr driver,
              return -1;

          disk->src = NULL;
+        virDomainDiskDefFree(disk);
          return 0;
      }


This patch is corrupted, please use git-send-email next time. But since the diff is trivial to apply I did the change by hand.

Nice catch! Pushed.

Reviewed-by: Michal Privoznik <mprivozn@xxxxxxxxxx>

Congratulations on your first libvirt contribution!

Michal




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux