mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 07:05:28 +00:00
admin: use g_autofree
Signed-off-by: Gaurav Agrawal <agrawalgaurav@gnome.org> [removed dead assignment] Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
bd9dfc58b4
commit
2c322c5514
@ -111,7 +111,7 @@ getSocketPath(virURIPtr uri)
|
|||||||
virURIParamPtr param = &uri->params[i];
|
virURIParamPtr param = &uri->params[i];
|
||||||
|
|
||||||
if (STREQ(param->name, "socket")) {
|
if (STREQ(param->name, "socket")) {
|
||||||
VIR_FREE(sock_path);
|
g_free(sock_path);
|
||||||
sock_path = g_strdup(param->value);
|
sock_path = g_strdup(param->value);
|
||||||
} else {
|
} else {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
@ -203,11 +203,11 @@ virAdmGetDefaultURI(virConfPtr conf, char **uristr)
|
|||||||
virAdmConnectPtr
|
virAdmConnectPtr
|
||||||
virAdmConnectOpen(const char *name, unsigned int flags)
|
virAdmConnectOpen(const char *name, unsigned int flags)
|
||||||
{
|
{
|
||||||
char *sock_path = NULL;
|
g_autofree char *sock_path = NULL;
|
||||||
char *alias = NULL;
|
char *alias = NULL;
|
||||||
virAdmConnectPtr conn = NULL;
|
virAdmConnectPtr conn = NULL;
|
||||||
g_autoptr(virConf) conf = NULL;
|
g_autoptr(virConf) conf = NULL;
|
||||||
char *uristr = NULL;
|
g_autofree char *uristr = NULL;
|
||||||
|
|
||||||
if (virAdmInitialize() < 0)
|
if (virAdmInitialize() < 0)
|
||||||
goto error;
|
goto error;
|
||||||
@ -233,7 +233,7 @@ virAdmConnectOpen(const char *name, unsigned int flags)
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (alias) {
|
if (alias) {
|
||||||
VIR_FREE(uristr);
|
g_free(uristr);
|
||||||
uristr = alias;
|
uristr = alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,16 +251,12 @@ virAdmConnectOpen(const char *name, unsigned int flags)
|
|||||||
if (remoteAdminConnectOpen(conn, flags) < 0)
|
if (remoteAdminConnectOpen(conn, flags) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
VIR_FREE(sock_path);
|
|
||||||
VIR_FREE(uristr);
|
|
||||||
return conn;
|
return conn;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
virDispatchError(NULL);
|
virDispatchError(NULL);
|
||||||
virObjectUnref(conn);
|
virObjectUnref(conn);
|
||||||
conn = NULL;
|
return NULL;
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user