It looks like openvzFreeDriver cannot call VIR_FREE on its buffer
argument, because of the use in the function that just happens to
be a few lines below. These are the only two uses of openvzFreeDriver.
From 0a616cd03cca9c9d89f23dadd52cd23c30789aca Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Mon, 15 Feb 2010 18:33:38 +0100
Subject: [PATCH] openvz_driver.c: avoid leak on OOM error path
* src/openvz/openvz_driver.c (openvzOpen): Free "driver" buffer
upon failure.
---
src/openvz/openvz_driver.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 68d0398..3a8a82f 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -1245,22 +1245,23 @@ static virDrvOpenStatus openvzOpen(virConnectPtr conn,
goto cleanup;
if (openvzExtractVersion(conn, driver) < 0)
goto cleanup;
conn->privateData = driver;
return VIR_DRV_OPEN_SUCCESS;
cleanup:
openvzFreeDriver(driver);
+ VIR_FREE(driver);
return VIR_DRV_OPEN_ERROR;
};
static int openvzClose(virConnectPtr conn) {
struct openvz_driver *driver = conn->privateData;
openvzFreeDriver(driver);
conn->privateData = NULL;
return 0;
}
--
1.7.0.181.g41533