mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-24 06:03:52 +03:00
Use virURIFree instead of xmlFreeURI
Since we defined a custom virURIPtr type, we should use a virURIFree method instead of assuming it will always be a typedef for xmlURIPtr * src/util/viruri.c, src/util/viruri.h, src/libvirt_private.syms: Add a virURIFree method * src/datatypes.c, src/esx/esx_driver.c, src/libvirt.c, src/qemu/qemu_migration.c, src/vmx/vmx.c, src/xen/xend_internal.c, tests/viruritest.c: s/xmlFreeURI/virURIFree/ Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
6a7ffd4389
commit
c33dae3175
@ -117,7 +117,7 @@ virReleaseConnect(virConnectPtr conn) {
|
||||
|
||||
virResetError(&conn->err);
|
||||
|
||||
xmlFreeURI(conn->uri);
|
||||
virURIFree(conn->uri);
|
||||
|
||||
virMutexUnlock(&conn->lock);
|
||||
virMutexDestroy(&conn->lock);
|
||||
|
@ -4072,7 +4072,7 @@ esxDomainMigratePerform(virDomainPtr domain,
|
||||
result = 0;
|
||||
|
||||
cleanup:
|
||||
xmlFreeURI(parsedUri);
|
||||
virURIFree(parsedUri);
|
||||
esxVI_ObjectContent_Free(&virtualMachine);
|
||||
esxVI_Event_Free(&eventList);
|
||||
esxVI_ManagedObjectReference_Free(&task);
|
||||
|
@ -5071,10 +5071,10 @@ virDomainMigratePeer2Peer (virDomainPtr domain,
|
||||
if (!tempuri->server || STRPREFIX(tempuri->server, "localhost")) {
|
||||
virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||
virDispatchError(domain->conn);
|
||||
xmlFreeURI(tempuri);
|
||||
virURIFree(tempuri);
|
||||
return -1;
|
||||
}
|
||||
xmlFreeURI(tempuri);
|
||||
virURIFree(tempuri);
|
||||
|
||||
/* Perform the migration. The driver isn't supposed to return
|
||||
* until the migration is complete.
|
||||
|
@ -1472,6 +1472,7 @@ virTypedParameterAssign;
|
||||
|
||||
# viruri.h
|
||||
virURIFormat;
|
||||
virURIFree;
|
||||
virURIParse;
|
||||
|
||||
|
||||
|
@ -1956,7 +1956,7 @@ static int doNativeMigrate(struct qemud_driver *driver,
|
||||
if (spec.destType == MIGRATION_DEST_FD)
|
||||
VIR_FORCE_CLOSE(spec.dest.fd.qemu);
|
||||
|
||||
xmlFreeURI(uribits);
|
||||
virURIFree(uribits);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -91,3 +91,15 @@ virURIFormat(xmlURIPtr uri)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virURIFree:
|
||||
* @uri: uri to free
|
||||
*
|
||||
* Frees the URI
|
||||
*/
|
||||
void virURIFree(virURIPtr uri)
|
||||
{
|
||||
xmlFreeURI(uri);
|
||||
}
|
||||
|
@ -19,4 +19,6 @@ typedef xmlURIPtr virURIPtr;
|
||||
virURIPtr virURIParse(const char *uri);
|
||||
char *virURIFormat(virURIPtr uri);
|
||||
|
||||
void virURIFree(virURIPtr uri);
|
||||
|
||||
#endif /* __VIR_URI_H__ */
|
||||
|
@ -2696,7 +2696,7 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port,
|
||||
VIR_FREE(fileType);
|
||||
VIR_FREE(fileName);
|
||||
VIR_FREE(network_endPoint);
|
||||
xmlFreeURI(parsedUri);
|
||||
virURIFree(parsedUri);
|
||||
|
||||
return result;
|
||||
|
||||
|
@ -3234,25 +3234,25 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
|
||||
virXendError(VIR_ERR_INVALID_ARG,
|
||||
"%s", _("xenDaemonDomainMigrate: only xenmigr://"
|
||||
" migrations are supported by Xen"));
|
||||
xmlFreeURI (uriptr);
|
||||
virURIFree (uriptr);
|
||||
return -1;
|
||||
}
|
||||
if (!uriptr->server) {
|
||||
virXendError(VIR_ERR_INVALID_ARG,
|
||||
"%s", _("xenDaemonDomainMigrate: a hostname must be"
|
||||
" specified in the URI"));
|
||||
xmlFreeURI (uriptr);
|
||||
virURIFree (uriptr);
|
||||
return -1;
|
||||
}
|
||||
hostname = strdup (uriptr->server);
|
||||
if (!hostname) {
|
||||
virReportOOMError();
|
||||
xmlFreeURI (uriptr);
|
||||
virURIFree (uriptr);
|
||||
return -1;
|
||||
}
|
||||
if (uriptr->port)
|
||||
snprintf (port, sizeof port, "%d", uriptr->port);
|
||||
xmlFreeURI (uriptr);
|
||||
virURIFree (uriptr);
|
||||
}
|
||||
else if ((p = strrchr (uri, ':')) != NULL) { /* "hostname:port" */
|
||||
int port_nr, n;
|
||||
|
@ -105,7 +105,7 @@ static int testURIParse(const void *args)
|
||||
ret = 0;
|
||||
cleanup:
|
||||
VIR_FREE(uristr);
|
||||
xmlFreeURI(uri);
|
||||
virURIFree(uri);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user