[libvirt] [libvirt-php][PATCH 5/7] libvirt_domain_new: Resolve couple of memleaks
Erik Skultety
eskultet at redhat.com
Fri Dec 8 08:49:03 UTC 2017
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 at redhat.com>
> ---
> 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 at redhat.com>
>
> 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 at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
More information about the libvir-list
mailing list