Re: [libvirt] [PATCH] openvz_driver.c: avoid leak on OOM error path

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

 



2010/2/15 Jim Meyering <jim@xxxxxxxxxxxx>:
> Matthias Bolte wrote:
> ...
>> Why do you think openvzFreeDriver must not VIR_FREE the driver object?
>> The driver object is allocated per connection in openvzOpen, so
>> openvzClose has to VIR_FREE it.
>
> I was lazy, and assumed there wouldn't be so many leaks.
> I should have looked.
>
> Here's a better patch.  Thanks for keeping me honest.

:-)

> From 2b865b8f955d88bb687a429efd636dd2212cd13b Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering@xxxxxxxxxx>
> Date: Mon, 15 Feb 2010 18:33:38 +0100
> Subject: [PATCH] openvz (openvzFreeDriver): avoid leaks
>
> * src/openvz/openvz_conf.c (openvzFreeDriver): Also free driver buffer.
> Based on a suggestion from Matthias Bolte.
> ---
>  src/openvz/openvz_conf.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
> index f4b8199..51dbde5 100644
> --- a/src/openvz/openvz_conf.c
> +++ b/src/openvz/openvz_conf.c
> @@ -427,6 +427,7 @@ openvzFreeDriver(struct openvz_driver *driver)
>
>     virDomainObjListDeinit(&driver->domains);
>     virCapabilitiesFree(driver->caps);
> +    VIR_FREE(driver);
>  }
>
>
> --
> 1.7.0.181.g41533
>

ACK

Matthias

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