[libvirt] PATCH: 11/28: Reduce return points for UML driver

Jim Meyering jim at meyering.net
Mon Dec 1 09:32:34 UTC 2008


Ron Yorston <rmy at tigress.co.uk> wrote:
> "Daniel P. Berrange" <berrange at 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 at redhat.com>

       uml: don't free an uninitialized variable
       * src/uml_driver.c (umlDomainShutdown): Initialize "info".
       Patch and bug report from Ron Yorston <rmy at tigress.co.uk>.

>From c0cc0c4be0ba4add32c5c3a71941a21b514ca15c Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at 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 at 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(&umlStateDriver);
     return 0;
 }
-
--
1.6.0.4.1101.g642f8




More information about the libvir-list mailing list