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

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

 



Ron Yorston <rmy@xxxxxxxxxxxxx> wrote:
> "Daniel P. Berrange" <berrange@xxxxxxxxxx> 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@xxxxxxxxxx>

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

>From c0cc0c4be0ba4add32c5c3a71941a21b514ca15c Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@xxxxxxxxxx>
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@xxxxxxxxxxxxx>.
---
 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

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