mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 05:17:59 +03:00
remove useless tests before xmlFree
* src/qemu_conf.c (qemudParseDiskXML, qemudParseInterfaceXML): (qemudParseInputXML, qemudParseDhcpRangesXML): * src/remote_internal.c (doRemoteOpen): * src/storage_conf.c (virStoragePoolDefParseDoc): * src/xm_internal.c (xenXMParseXMLDisk, xenXMParseXMLVif): (xenXMParseXMLToConfig, xenXMAttachInterface): * src/xml.c (virDomainParseXMLDiskDesc, virDomainParseXMLIfDesc): (virDomainXMLDevID):
This commit is contained in:
parent
e9c7af6864
commit
0c37f59802
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
||||
Tue Apr 29 21:43:28 CEST 2008 Jim Meyering <meyering@redhat.com>
|
||||
|
||||
remove useless tests before xmlFree
|
||||
* src/qemu_conf.c (qemudParseDiskXML, qemudParseInterfaceXML):
|
||||
(qemudParseInputXML, qemudParseDhcpRangesXML):
|
||||
* src/remote_internal.c (doRemoteOpen):
|
||||
* src/storage_conf.c (virStoragePoolDefParseDoc):
|
||||
* src/xm_internal.c (xenXMParseXMLDisk, xenXMParseXMLVif):
|
||||
(xenXMParseXMLToConfig, xenXMAttachInterface):
|
||||
* src/xml.c (virDomainParseXMLDiskDesc, virDomainParseXMLIfDesc):
|
||||
(virDomainXMLDevID):
|
||||
|
||||
Tue Apr 29 11:36:00 EST 2008 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* src/Makefile.am: Explicitly tell gcov to look in .libs for
|
||||
|
@ -680,14 +680,10 @@ static int qemudParseDiskXML(virConnectPtr conn,
|
||||
return 0;
|
||||
|
||||
error:
|
||||
if (type)
|
||||
xmlFree(type);
|
||||
if (target)
|
||||
xmlFree(target);
|
||||
if (source)
|
||||
xmlFree(source);
|
||||
if (device)
|
||||
xmlFree(device);
|
||||
xmlFree(type);
|
||||
xmlFree(target);
|
||||
xmlFree(source);
|
||||
xmlFree(device);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -941,18 +937,12 @@ static int qemudParseInterfaceXML(virConnectPtr conn,
|
||||
return 0;
|
||||
|
||||
error:
|
||||
if (network)
|
||||
xmlFree(network);
|
||||
if (address)
|
||||
xmlFree(address);
|
||||
if (port)
|
||||
xmlFree(port);
|
||||
if (ifname)
|
||||
xmlFree(ifname);
|
||||
if (script)
|
||||
xmlFree(script);
|
||||
if (bridge)
|
||||
xmlFree(bridge);
|
||||
xmlFree(network);
|
||||
xmlFree(address);
|
||||
xmlFree(port);
|
||||
xmlFree(ifname);
|
||||
xmlFree(script);
|
||||
xmlFree(bridge);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1334,18 +1324,14 @@ static int qemudParseInputXML(virConnectPtr conn,
|
||||
input->bus = QEMU_INPUT_BUS_USB;
|
||||
}
|
||||
|
||||
if (type)
|
||||
xmlFree(type);
|
||||
if (bus)
|
||||
xmlFree(bus);
|
||||
xmlFree(type);
|
||||
xmlFree(bus);
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
if (type)
|
||||
xmlFree(type);
|
||||
if (bus)
|
||||
xmlFree(bus);
|
||||
xmlFree(type);
|
||||
xmlFree(bus);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -2860,10 +2846,8 @@ static int qemudParseDhcpRangesXML(virConnectPtr conn,
|
||||
free(range);
|
||||
}
|
||||
|
||||
if (start)
|
||||
xmlFree(start);
|
||||
if (end)
|
||||
xmlFree(end);
|
||||
xmlFree(start);
|
||||
xmlFree(end);
|
||||
|
||||
cur = cur->next;
|
||||
}
|
||||
|
@ -434,9 +434,9 @@ doRemoteOpen (virConnectPtr conn,
|
||||
}
|
||||
|
||||
#ifdef HAVE_XMLURI_QUERY_RAW
|
||||
if (uri->query_raw) xmlFree (uri->query_raw);
|
||||
xmlFree (uri->query_raw);
|
||||
#else
|
||||
if (uri->query) xmlFree (uri->query);
|
||||
xmlFree (uri->query);
|
||||
#endif
|
||||
|
||||
if ((
|
||||
@ -464,10 +464,10 @@ doRemoteOpen (virConnectPtr conn,
|
||||
transport_str[-1] = '\0';
|
||||
}
|
||||
/* Remove the username, server name and port number. */
|
||||
if (uri->user) xmlFree (uri->user);
|
||||
xmlFree (uri->user);
|
||||
uri->user = 0;
|
||||
|
||||
if (uri->server) xmlFree (uri->server);
|
||||
xmlFree (uri->server);
|
||||
uri->server = 0;
|
||||
|
||||
uri->port = 0;
|
||||
|
@ -357,8 +357,7 @@ virStoragePoolDefParseDoc(virConnectPtr conn,
|
||||
|
||||
cleanup:
|
||||
free(uuid);
|
||||
if (type)
|
||||
xmlFree(type);
|
||||
xmlFree(type);
|
||||
virStoragePoolDefFree(ret);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1657,10 +1657,8 @@ static int xenXMParseXMLDisk(xmlNodePtr node, int hvm, int xendConfigVersion, ch
|
||||
}
|
||||
|
||||
if (target == NULL) {
|
||||
if (source != NULL)
|
||||
xmlFree(source);
|
||||
if (device != NULL)
|
||||
xmlFree(device);
|
||||
xmlFree(source);
|
||||
xmlFree(device);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
@ -1687,10 +1685,8 @@ static int xenXMParseXMLDisk(xmlNodePtr node, int hvm, int xendConfigVersion, ch
|
||||
}
|
||||
|
||||
if (source == NULL && !cdrom) {
|
||||
if (target != NULL)
|
||||
xmlFree(target);
|
||||
if (device != NULL)
|
||||
xmlFree(device);
|
||||
xmlFree(target);
|
||||
xmlFree(device);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
@ -1765,8 +1761,7 @@ static int xenXMParseXMLDisk(xmlNodePtr node, int hvm, int xendConfigVersion, ch
|
||||
xmlFree(drvName);
|
||||
xmlFree(device);
|
||||
xmlFree(target);
|
||||
if(source)
|
||||
xmlFree(source);
|
||||
xmlFree(source);
|
||||
*disk = buf;
|
||||
|
||||
return (ret);
|
||||
@ -1877,14 +1872,10 @@ static char *xenXMParseXMLVif(virConnectPtr conn, xmlNodePtr node, int hvm) {
|
||||
|
||||
cleanup:
|
||||
free(bridge);
|
||||
if (mac != NULL)
|
||||
xmlFree(mac);
|
||||
if (source != NULL)
|
||||
xmlFree(source);
|
||||
if (script != NULL)
|
||||
xmlFree(script);
|
||||
if (ip != NULL)
|
||||
xmlFree(ip);
|
||||
xmlFree(mac);
|
||||
xmlFree(source);
|
||||
xmlFree(script);
|
||||
xmlFree(ip);
|
||||
|
||||
return buf;
|
||||
}
|
||||
@ -2164,8 +2155,7 @@ virConfPtr xenXMParseXMLToConfig(virConnectPtr conn, const char *xml) {
|
||||
strcat(val, ",vncdisplay=");
|
||||
strcat(val, portstr);
|
||||
}
|
||||
if (vncport)
|
||||
xmlFree(vncport);
|
||||
xmlFree(vncport);
|
||||
if (vnclisten) {
|
||||
strcat(val, ",vnclisten=");
|
||||
strcat(val, (const char*)vnclisten);
|
||||
@ -2310,8 +2300,7 @@ virConfPtr xenXMParseXMLToConfig(virConnectPtr conn, const char *xml) {
|
||||
error:
|
||||
if (conf)
|
||||
virConfFree(conf);
|
||||
if (prop != NULL)
|
||||
xmlFree(prop);
|
||||
xmlFree(prop);
|
||||
xmlXPathFreeObject(obj);
|
||||
xmlXPathFreeContext(ctxt);
|
||||
if (doc != NULL)
|
||||
@ -2960,12 +2949,9 @@ xenXMAttachInterface(virDomainPtr domain, xmlXPathContextPtr ctxt, int hvm,
|
||||
goto cleanup;
|
||||
|
||||
node_cleanup:
|
||||
if (node_tmp)
|
||||
xmlFree(node_tmp);
|
||||
if (attr_node)
|
||||
xmlFree(attr_node);
|
||||
if (text_node)
|
||||
xmlFree(text_node);
|
||||
xmlFree(node_tmp);
|
||||
xmlFree(attr_node);
|
||||
xmlFree(text_node);
|
||||
cleanup:
|
||||
free(type);
|
||||
free(source);
|
||||
|
30
src/xml.c
30
src/xml.c
@ -1341,16 +1341,11 @@ virDomainParseXMLDiskDesc(virConnectPtr conn, xmlNodePtr node,
|
||||
virBufferAddLit(buf, ")");
|
||||
|
||||
cleanup:
|
||||
if (drvType)
|
||||
xmlFree(drvType);
|
||||
if (drvName)
|
||||
xmlFree(drvName);
|
||||
if (device)
|
||||
xmlFree(device);
|
||||
if (target)
|
||||
xmlFree(target);
|
||||
if (source)
|
||||
xmlFree(source);
|
||||
xmlFree(drvType);
|
||||
xmlFree(drvName);
|
||||
xmlFree(device);
|
||||
xmlFree(target);
|
||||
xmlFree(source);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@ -1466,14 +1461,10 @@ virDomainParseXMLIfDesc(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virBufferAddLit(buf, ")");
|
||||
ret = 0;
|
||||
error:
|
||||
if (mac != NULL)
|
||||
xmlFree(mac);
|
||||
if (source != NULL)
|
||||
xmlFree(source);
|
||||
if (script != NULL)
|
||||
xmlFree(script);
|
||||
if (ip != NULL)
|
||||
xmlFree(ip);
|
||||
xmlFree(mac);
|
||||
xmlFree(source);
|
||||
xmlFree(script);
|
||||
xmlFree(ip);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@ -1953,8 +1944,7 @@ virDomainXMLDevID(virDomainPtr domain, const char *xmldesc, char *class,
|
||||
cleanup:
|
||||
if (xml != NULL)
|
||||
xmlFreeDoc(xml);
|
||||
if (attr != NULL)
|
||||
xmlFree(attr);
|
||||
xmlFree(attr);
|
||||
return ret;
|
||||
}
|
||||
#endif /* WITH_XEN */
|
||||
|
Loading…
Reference in New Issue
Block a user