mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +00: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;
|
||||
int res;
|
||||
virConnectPtr ret;
|
||||
g_autoptr(virConnect) ret = NULL;
|
||||
g_autoptr(virConf) conf = NULL;
|
||||
char *uristr = NULL;
|
||||
g_autofree char *uristr = NULL;
|
||||
bool embed = false;
|
||||
|
||||
ret = virGetConnect();
|
||||
@ -1151,14 +1151,9 @@ virConnectOpenInternal(const char *name,
|
||||
goto failed;
|
||||
}
|
||||
|
||||
VIR_FREE(uristr);
|
||||
|
||||
return ret;
|
||||
return g_steal_pointer(&ret);
|
||||
|
||||
failed:
|
||||
VIR_FREE(uristr);
|
||||
virObjectUnref(ret);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user