Re: [libvirt-php][PATCH 5/7] libvirt_domain_new: Resolve couple of memleaks

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

 



On Thu, Dec 07, 2017 at 10:23:00AM +0100, Michal Privoznik wrote:
> There are still some, but it's definitely better now.
>
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  src/libvirt-domain.c | 27 ++++++++++++++++++++++-----
>  1 file changed, 22 insertions(+), 5 deletions(-)
>

...

>      set_vnc_location(vncl TSRMLS_CC);
>
> +    VIR_FREE(tmp);
>      tmp = installation_get_xml(conn->conn, name, memMB, maxmemMB,
>                                 NULL /* arch */, uuid, vcpus, NULL,
>                                 vmDisks, numDisks, vmNetworks, numNets,
> @@ -232,6 +243,9 @@ PHP_FUNCTION(libvirt_domain_new)
>      resource_change_counter(INT_RESOURCE_DOMAIN, conn->conn, res_domain->domain, 1 TSRMLS_CC);
>
>      VIRT_REGISTER_RESOURCE(res_domain, le_libvirt_domain);
> +    VIR_FREE(vmDisks);
> +    VIR_FREE(vmNetworks);
> +    VIR_FREE(tmp);
>      return;

You still leak @hostname. Also there are multiple occurrences of @hostname
within the module which don't appear to be freed either, but since I have no
idea what zend_parse_parameters (one of the APIs where engineering definitely
wasn't done right...) does, I can't be sure unless I ask valgrind...

Reviewed-by: Erik Skultety <eskultet@xxxxxxxxxx>

>
>   error:
> @@ -243,6 +257,9 @@ PHP_FUNCTION(libvirt_domain_new)
>      }
>      if (domainUpdated)
>          virDomainFree(domainUpdated);
> +    VIR_FREE(vmDisks);
> +    VIR_FREE(vmNetworks);
> +    VIR_FREE(tmp);
>      RETURN_FALSE;
>  }
>
> --
> 2.13.6
>
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

--
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