[PATCH] admin: use g_autofree

Ján Tomko jtomko at redhat.com
Sat Feb 29 16:28:37 UTC 2020


On a Saturday in 2020, Gaurav Agrawal wrote:
>From: GAURAV AGRAWAL <agrawalgaurav at gnome.org>
>

Your author name is in all caps, consider using the same form
as below:

>Signed-off-by: Gaurav Agrawal <agrawalgaurav at gnome.org>

To see where it comes from you can use --show-origin:
  $ git config --show-origin user.name
  file:/home/jtomko/.gitconfig    Ján Tomko

>---
> src/admin/libvirt-admin.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
>
>diff --git a/src/admin/libvirt-admin.c b/src/admin/libvirt-admin.c
>index 4099a54854..d841a15f95 100644
>--- a/src/admin/libvirt-admin.c
>+++ b/src/admin/libvirt-admin.c
>@@ -251,14 +251,11 @@ virAdmConnectOpen(const char *name, unsigned int flags)
>     if (remoteAdminConnectOpen(conn, flags) < 0)
>         goto error;
>
>- cleanup:
>-    VIR_FREE(sock_path);
>-    VIR_FREE(uristr);
>+cleanup:
>     return conn;
>
>  error:
>     virDispatchError(NULL);

>-    virObjectUnref(conn);

'conn' is still not marked as g_auto, so this unref needs to stay.

>     conn = NULL;
>     goto cleanup;

These two lines can be replaced by return NULL, and the cleanup: label
above removed.

Jano

> }
>-- 
>2.24.1
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200229/0b4f6d09/attachment-0001.sig>


More information about the libvir-list mailing list