[libvirt] [PATCH 1/6] networkBuildDhcpDaemonCommandLine: Don't leak @configstr

Martin Kletzander mkletzan at redhat.com
Thu Nov 14 11:35:44 UTC 2013


On Thu, Nov 14, 2013 at 10:51:11AM +0100, Michal Privoznik wrote:
> In the function an helper to build the dnsmasq config file is used. The
> content to be stored then into the config file is kept in @configstr
> variable. However, once written, it's never freed and as soon as the
> control reaches the 'return' line, the variable (and hence allocated
> memory handle) will go off the scope and is leaked.
> 

Vary hard to parse, I'd say $SUBJ is enough.

> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/network/bridge_driver.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
> index 3423a45..fd4dfc9 100644
> --- a/src/network/bridge_driver.c
> +++ b/src/network/bridge_driver.c
> @@ -1061,6 +1061,7 @@ networkBuildDhcpDaemonCommandLine(virNetworkObjPtr network,
>      *cmdout = cmd;
>      ret = 0;
>  cleanup:
> +    VIR_FREE(configstr);
>      return ret;
>  }
>  
> -- 
> 1.8.3.2
> 

ACK,

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20131114/70852cc1/attachment-0001.sig>


More information about the libvir-list mailing list