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