mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
virConnectOpenInternal: Switch to automatic memory cleanup
Use automatic cleanup for 'ret' and 'uristr'. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
48e1b49353
commit
000bb404e5
@ -882,9 +882,9 @@ virConnectOpenInternal(const char *name,
|
|||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
int res;
|
int res;
|
||||||
virConnectPtr ret;
|
g_autoptr(virConnect) ret = NULL;
|
||||||
g_autoptr(virConf) conf = NULL;
|
g_autoptr(virConf) conf = NULL;
|
||||||
char *uristr = NULL;
|
g_autofree char *uristr = NULL;
|
||||||
bool embed = false;
|
bool embed = false;
|
||||||
|
|
||||||
ret = virGetConnect();
|
ret = virGetConnect();
|
||||||
@ -1151,14 +1151,9 @@ virConnectOpenInternal(const char *name,
|
|||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
VIR_FREE(uristr);
|
return g_steal_pointer(&ret);
|
||||||
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
failed:
|
failed:
|
||||||
VIR_FREE(uristr);
|
|
||||||
virObjectUnref(ret);
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user