Re: [PATCH 1/8] virDomainDefFree: Don't leak initenv name and value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 04, 2017 at 16:22:29 +0200, Michal Privoznik wrote:
> When parsing boot options from domain XML in
> virDomainDefParseBootOptions() initenv id stored to:

In this function there's a very shady approach to extract the contents
of the XML element.

> 
>     def->os.initenv[i]->name
>     def->os.initenv[i]->value
> 
> But these are never freed.
> 
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  src/conf/domain_conf.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 640f29d3e..8168dc52f 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -2931,8 +2931,11 @@ void virDomainDefFree(virDomainDefPtr def)
>      for (i = 0; def->os.initargv && def->os.initargv[i]; i++)
>          VIR_FREE(def->os.initargv[i]);
>      VIR_FREE(def->os.initargv);
> -    for (i = 0; def->os.initenv && def->os.initenv[i]; i++)
> +    for (i = 0; def->os.initenv && def->os.initenv[i]; i++) {
> +        VIR_FREE(def->os.initenv[i]->name);
> +        VIR_FREE(def->os.initenv[i]->value);
>          VIR_FREE(def->os.initenv[i]);

ACK to this though

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux