[PATCH] admin: use g_autofree

Peter Krempa pkrempa at redhat.com
Mon Mar 2 08:36:58 UTC 2020


On Mon, Mar 02, 2020 at 07:22:03 +0530, Gaurav Agrawal wrote:
> Signed-off-by: Gaurav Agrawal <agrawalgaurav at gnome.org>
> ---
>  src/admin/libvirt-admin.c | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)

[...]

> @@ -251,16 +251,11 @@ virAdmConnectOpen(const char *name, unsigned int flags)
>      if (remoteAdminConnectOpen(conn, flags) < 0)
>          goto error;
>  
> - cleanup:
> -    VIR_FREE(sock_path);
> -    VIR_FREE(uristr);
> -    return conn;

Removing this 'return' will make this function ALWAYS return NULL when
the control flow now continues through the error label.

>  
>   error:
>      virDispatchError(NULL);
>      virObjectUnref(conn);
> -    conn = NULL;
> -    goto cleanup;
> +    return NULL;
>  }




More information about the libvir-list mailing list