[libvirt] [PATCH] qemuInitPasswords: avoid unconditional leak

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

 



A successful getVolumeQcowPassphrase allocates "secret".
Nothing freed it.

>From 2aa6d3c4254f587133e473f4d193ccb023507665 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@xxxxxxxxxx>
Date: Tue, 16 Feb 2010 09:22:02 +0100
Subject: [PATCH] qemuInitPasswords: avoid unconditional leak

* src/qemu/qemu_driver.c (qemuInitPasswords): Free pass-phrase buffer.
---
 src/qemu/qemu_driver.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 03feaf4..e8b7cf6 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1733,34 +1733,35 @@ qemuInitPasswords(virConnectPtr conn,
         for (i = 0 ; i < vm->def->ndisks ; i++) {
             char *secret;
             size_t secretLen;

             if (!vm->def->disks[i]->encryption ||
                 !vm->def->disks[i]->src)
                 continue;

             if (getVolumeQcowPassphrase(conn,
                                         vm->def->disks[i],
                                         &secret, &secretLen) < 0)
                 goto cleanup;

             qemuDomainObjEnterMonitorWithDriver(driver, vm);
             ret = qemuMonitorSetDrivePassphrase(priv->mon,
                                                 vm->def->disks[i]->info.alias,
                                                 secret);
+            VIR_FREE(secret);
             qemuDomainObjExitMonitorWithDriver(driver, vm);
             if (ret < 0)
                 goto cleanup;
         }
     }

 cleanup:
     return ret;
 }


 #define QEMU_PCI_VENDOR_INTEL     0x8086
 #define QEMU_PCI_VENDOR_LSI_LOGIC 0x1000
 #define QEMU_PCI_VENDOR_REDHAT    0x1af4
 #define QEMU_PCI_VENDOR_CIRRUS    0x1013
 #define QEMU_PCI_VENDOR_REALTEK   0x10ec
 #define QEMU_PCI_VENDOR_AMD       0x1022
--
1.7.0.181.g41533

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