Re: [PATCH] conf: use virDomainDeviceDefFree free dev

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

 





On 9/19/19 5:01 AM, Xu Yandong wrote:
In function virDomainDeviceDefParse, we shoud use virDomainDeviceDefFree
free data structure avoid potential memory leak.

Signed-off-by: Xu Yandong <xuyandong2@xxxxxxxxxx>
---
  src/conf/domain_conf.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 848c831330..8fb9480827 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -16504,7 +16504,8 @@ virDomainDeviceDefParse(const char *xmlStr,
      return dev;
error:
-    VIR_FREE(dev);
+    virDomainDeviceDefFree(dev);
+    dev = NULL;
      goto cleanup;


Just noticed that the current master code does not have this potential
leak anymore. It was fixed by commit 475777c9ec, introducing
VIR_AUTOFREE() for virDomainDeviceDefPtr.



Thanks,


DHB





  }

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

  Powered by Linux