[libvirt] [PATCH] conf: use virDomainDeviceDefFree free dev

Xu Yandong xuyandong2 at huawei.com
Thu Sep 19 08:01:16 UTC 2019


In function virDomainDeviceDefParse, we shoud use virDomainDeviceDefFree
free data structure avoid potential memory leak.

Signed-off-by: Xu Yandong <xuyandong2 at huawei.com>
---
 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;
 }
 
-- 
2.18.1




More information about the libvir-list mailing list