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

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

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 redhat com>
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)

+    VIR_FREE(driver);


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