Ron Yorston <rmy(a)tigress.co.uk> wrote:
"Daniel P. Berrange" <berrange(a)redhat.com> wrote:
> static int umlDomainShutdown(virDomainPtr dom) {
...
>+ char *info;
...
> VIR_FREE(info);
...
info should be initialised to NULL, otherwise the VIR_FREE will
fail.
With the umlMonitorCommand if'ed out this is also broken before the
patch, which is how I came to notice it.
Ron
Thanks for reporting that!
I'll commit the following shortly:
Mon Nov 30 10:28:21 CET 2008 Jim Meyering <meyering(a)redhat.com>
uml: don't free an uninitialized variable
* src/uml_driver.c (umlDomainShutdown): Initialize "info".
Patch and bug report from Ron Yorston <rmy(a)tigress.co.uk>.
From c0cc0c4be0ba4add32c5c3a71941a21b514ca15c Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Mon, 1 Dec 2008 10:30:10 +0100
Subject: [PATCH] uml: don't free an uninitialized variable
* src/uml_driver.c (umlDomainShutdown): Initialize "info".
Patch and bug report from Ron Yorston <rmy(a)tigress.co.uk>.
---
src/uml_driver.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/src/uml_driver.c b/src/uml_driver.c
index 1ce1d78..dcf3f66 100644
--- a/src/uml_driver.c
+++ b/src/uml_driver.c
@@ -1163,7 +1163,7 @@ static virDomainPtr umlDomainCreate(virConnectPtr conn, const char
*xml,
static int umlDomainShutdown(virDomainPtr dom) {
struct uml_driver *driver = (struct uml_driver *)dom->conn->privateData;
virDomainObjPtr vm = virDomainFindByID(&driver->domains, dom->id);
- char* info;
+ char *info = NULL;
if (!vm) {
umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
@@ -1672,4 +1672,3 @@ int umlRegister(void) {
virRegisterStateDriver(¨StateDriver);
return 0;
}
-
--
1.6.0.4.1101.g642f8