[PATCH] conf: convert network_conf.c to use g_auto* pointers

Erik Skultety eskultet at redhat.com
Wed Jun 10 07:51:11 UTC 2020


On Wed, Jun 10, 2020 at 12:16:50AM -0400, Laine Stump wrote:
> This was mostly boilerplate conversion, but in one case I needed to
> define several differently named char* to take the place of a single
> char *tmp that was re-used multiple times, and in another place there
> was a single char* that was used at the toplevel of the function, and
> then later used repeatedly inside a for loop, so I defined a new
> separate char* inside the loop.
> 
> Signed-off-by: Laine Stump <laine at redhat.com>
> ---
> 
> This should be applied on top of Dan's IPv6 NAT patch series (it was
> reviewing that series that showed me this file hadn't yet been
> converted).

...

> @@ -689,14 +678,12 @@ virNetworkDHCPDefParseXML(const char *networkName,
>  
>              if (server &&
>                  virSocketAddrParse(&inaddr, server, AF_UNSPEC) < 0) {
> -                VIR_FREE(file);
> -                VIR_FREE(server);
>                  goto cleanup;
>              }
>  
>              def->bootfile = file;
> +            file = NULL;

g_steal_pointer would do as well

Reviewed-by: Erik Skultety <eskultet at redhat.com>




More information about the libvir-list mailing list