<div dir="ltr">On review by Jan Tomko, for my earlier Patchv2, which had the return NULL replace by the return conn , <br>here is the review:<br>```<br><span class="gmail-im" style="color:rgb(80,0,80)">>+cleanup:<br>>     return conn;<br>><br>>  error:<br>>     virDispatchError(NULL);<br><br>>-    virObjectUnref(conn);<br><br></span>'conn' is still not marked as g_auto, so this unref needs to stay.<span class="gmail-im" style="color:rgb(80,0,80)"><br><br>>     conn = NULL;<br>>     goto cleanup;<br><br></span>These two lines can be replaced by return NULL, and the cleanup: label<br>above removed.<br><br>```<div><br></div><div>I went ahead with what this review meant, and initially my PATCHv1 also did the same thing return NULL, because if there is an error the function is supposed to return NULL anyways.</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 2, 2020 at 2:08 PM Peter Krempa <<a href="mailto:pkrempa@redhat.com">pkrempa@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Mon, Mar 02, 2020 at 07:22:03 +0530, Gaurav Agrawal wrote:<br>
> Signed-off-by: Gaurav Agrawal <<a href="mailto:agrawalgaurav@gnome.org" target="_blank">agrawalgaurav@gnome.org</a>><br>
> ---<br>
>  src/admin/libvirt-admin.c | 15 +++++----------<br>
>  1 file changed, 5 insertions(+), 10 deletions(-)<br>
<br>
[...]<br>
<br>
> @@ -251,16 +251,11 @@ virAdmConnectOpen(const char *name, unsigned int flags)<br>
>      if (remoteAdminConnectOpen(conn, flags) < 0)<br>
>          goto error;<br>
>  <br>
> - cleanup:<br>
> -    VIR_FREE(sock_path);<br>
> -    VIR_FREE(uristr);<br>
> -    return conn;<br>
<br>
Removing this 'return' will make this function ALWAYS return NULL when<br>
the control flow now continues through the error label.<br>
<br>
>  <br>
>   error:<br>
>      virDispatchError(NULL);<br>
>      virObjectUnref(conn);<br>
> -    conn = NULL;<br>
> -    goto cleanup;<br>
> +    return NULL;<br>
>  }<br>
<br>
</blockquote></div>