[libvirt RFC PATCH 4/5] conf: don't call virDomainDeviceInfoClear from virDomainDeviceInfoParseXML

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

 



The DeviceInfo object sent to virDomainDeviceInfoParseXML() was
allocated with g_new0() just prior to the call (although in each case
there is some other code in between, none of it touches the
DeviceInfo); pretty clearly, the call to virDomainDeviceInfoClear() at
the top of virDomainDeviceInfoParseXML() was just overly paranoid
"safety code", and is unnecessary.

Likewise, the call to clear the device info on return when there is a
parse failure is also unnecessary, since in every case the caller
immediately frees the object after the failure.

So let's remove these.

Signed-off-by: Laine Stump <laine@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d8b8ef38f5..f2b00129e1 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6533,8 +6533,6 @@ virDomainDeviceInfoParseXML(virDomainXMLOptionPtr xmlopt,
     g_autofree char *rombar = NULL;
     g_autofree char *aliasStr = NULL;
 
-    virDomainDeviceInfoClear(info);
-
     cur = node->children;
     while (cur != NULL) {
         if (cur->type == XML_ELEMENT_NODE) {
@@ -6611,8 +6609,6 @@ virDomainDeviceInfoParseXML(virDomainXMLOptionPtr xmlopt,
 
     ret = 0;
  cleanup:
-    if (ret < 0)
-        virDomainDeviceInfoClear(info);
     return ret;
 }
 
-- 
2.29.2




[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