Re: [PATCH 1/2] qemuDomainDetachChrDevice: Don't leak @charAlias

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

 



s/@charAlias/@devstr/

On 07/18/13 12:44, Michal Privoznik wrote:
Moreover, since virAsprintf now does report OOM error, there's no need
to call virReportOOMError in error path.
---
  src/qemu/qemu_hotplug.c | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 788ad47..a98de9d 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -3155,10 +3155,8 @@ int qemuDomainDetachChrDevice(virQEMUDriverPtr driver,
      if (qemuBuildChrDeviceStr(&devstr, vm->def, chr, priv->qemuCaps) < 0)
          return ret;

-    if (virAsprintf(&charAlias, "char%s", tmpChr->info.alias) < 0) {
-        virReportOOMError();
-        return ret;
-    }
+    if (virAsprintf(&charAlias, "char%s", tmpChr->info.alias) < 0)
+        goto cleanup;

This actually would leak devstr from the function called above.


      qemuDomainObjEnterMonitor(driver, vm);
      if (devstr && qemuMonitorDelDevice(priv->mon, tmpChr->info.alias) < 0) {


ACK when you adjust the commit message

Peter

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[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]