|
|
43fe83 |
From 8a150535474e22c35508b075212b91478ba06de0 Mon Sep 17 00:00:00 2001
|
|
|
43fe83 |
Message-Id: <8a150535474e22c35508b075212b91478ba06de0.1377873641.git.jdenemar@redhat.com>
|
|
|
43fe83 |
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
|
|
43fe83 |
Date: Wed, 28 Aug 2013 10:24:12 +0200
|
|
|
43fe83 |
Subject: [PATCH] virsh: free the list from ListAll APIs even for 0 items
|
|
|
43fe83 |
|
|
|
43fe83 |
https://bugzilla.redhat.com/show_bug.cgi?id=1001957
|
|
|
43fe83 |
|
|
|
43fe83 |
virsh secret-list leak when no secrets are defined:
|
|
|
43fe83 |
|
|
|
43fe83 |
==27== 8 bytes in 1 blocks are definitely lost in loss record 6 of 726
|
|
|
43fe83 |
==27== by 0x4E941DD: virAllocN (viralloc.c:183)
|
|
|
43fe83 |
==27== by 0x5037F1A: remoteConnectListAllSecrets (remote_driver.c:3076)
|
|
|
43fe83 |
==27== by 0x5004EC6: virConnectListAllSecrets (libvirt.c:16298)
|
|
|
43fe83 |
==27== by 0x15F813: vshSecretListCollect (virsh-secret.c:397)
|
|
|
43fe83 |
==27== by 0x15F0E1: cmdSecretList (virsh-secret.c:532)
|
|
|
43fe83 |
|
|
|
43fe83 |
And so do some other *-list commands.
|
|
|
43fe83 |
|
|
|
43fe83 |
https://bugzilla.redhat.com/show_bug.cgi?id=1001536
|
|
|
43fe83 |
(cherry picked from commit f733eac058b373822708d3ec889dd80e281fa7e1)
|
|
|
43fe83 |
---
|
|
|
43fe83 |
tools/virsh-interface.c | 2 +-
|
|
|
43fe83 |
tools/virsh-network.c | 2 +-
|
|
|
43fe83 |
tools/virsh-nodedev.c | 2 +-
|
|
|
43fe83 |
tools/virsh-nwfilter.c | 2 +-
|
|
|
43fe83 |
tools/virsh-secret.c | 2 +-
|
|
|
43fe83 |
5 files changed, 5 insertions(+), 5 deletions(-)
|
|
|
43fe83 |
|
|
|
43fe83 |
diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c
|
|
|
43fe83 |
index 0f78551..3720c8c 100644
|
|
|
43fe83 |
--- a/tools/virsh-interface.c
|
|
|
43fe83 |
+++ b/tools/virsh-interface.c
|
|
|
43fe83 |
@@ -174,7 +174,7 @@ vshInterfaceListFree(vshInterfaceListPtr list)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
size_t i;
|
|
|
43fe83 |
|
|
|
43fe83 |
- if (list && list->nifaces) {
|
|
|
43fe83 |
+ if (list && list->ifaces) {
|
|
|
43fe83 |
for (i = 0; i < list->nifaces; i++) {
|
|
|
43fe83 |
if (list->ifaces[i])
|
|
|
43fe83 |
virInterfaceFree(list->ifaces[i]);
|
|
|
43fe83 |
diff --git a/tools/virsh-network.c b/tools/virsh-network.c
|
|
|
43fe83 |
index 06bf483..8ddd5ca 100644
|
|
|
43fe83 |
--- a/tools/virsh-network.c
|
|
|
43fe83 |
+++ b/tools/virsh-network.c
|
|
|
43fe83 |
@@ -423,7 +423,7 @@ vshNetworkListFree(vshNetworkListPtr list)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
size_t i;
|
|
|
43fe83 |
|
|
|
43fe83 |
- if (list && list->nnets) {
|
|
|
43fe83 |
+ if (list && list->nets) {
|
|
|
43fe83 |
for (i = 0; i < list->nnets; i++) {
|
|
|
43fe83 |
if (list->nets[i])
|
|
|
43fe83 |
virNetworkFree(list->nets[i]);
|
|
|
43fe83 |
diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c
|
|
|
43fe83 |
index 92ef40c..3a2d12b 100644
|
|
|
43fe83 |
--- a/tools/virsh-nodedev.c
|
|
|
43fe83 |
+++ b/tools/virsh-nodedev.c
|
|
|
43fe83 |
@@ -207,7 +207,7 @@ vshNodeDeviceListFree(vshNodeDeviceListPtr list)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
size_t i;
|
|
|
43fe83 |
|
|
|
43fe83 |
- if (list && list->ndevices) {
|
|
|
43fe83 |
+ if (list && list->devices) {
|
|
|
43fe83 |
for (i = 0; i < list->ndevices; i++) {
|
|
|
43fe83 |
if (list->devices[i])
|
|
|
43fe83 |
virNodeDeviceFree(list->devices[i]);
|
|
|
43fe83 |
diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c
|
|
|
43fe83 |
index fbf211a..e5fcb8f 100644
|
|
|
43fe83 |
--- a/tools/virsh-nwfilter.c
|
|
|
43fe83 |
+++ b/tools/virsh-nwfilter.c
|
|
|
43fe83 |
@@ -242,7 +242,7 @@ vshNWFilterListFree(vshNWFilterListPtr list)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
size_t i;
|
|
|
43fe83 |
|
|
|
43fe83 |
- if (list && list->nfilters) {
|
|
|
43fe83 |
+ if (list && list->filters) {
|
|
|
43fe83 |
for (i = 0; i < list->nfilters; i++) {
|
|
|
43fe83 |
if (list->filters[i])
|
|
|
43fe83 |
virNWFilterFree(list->filters[i]);
|
|
|
43fe83 |
diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c
|
|
|
43fe83 |
index 9d34c1a..c4763e3 100644
|
|
|
43fe83 |
--- a/tools/virsh-secret.c
|
|
|
43fe83 |
+++ b/tools/virsh-secret.c
|
|
|
43fe83 |
@@ -369,7 +369,7 @@ vshSecretListFree(vshSecretListPtr list)
|
|
|
43fe83 |
{
|
|
|
43fe83 |
size_t i;
|
|
|
43fe83 |
|
|
|
43fe83 |
- if (list && list->nsecrets) {
|
|
|
43fe83 |
+ if (list && list->secrets) {
|
|
|
43fe83 |
for (i = 0; i < list->nsecrets; i++) {
|
|
|
43fe83 |
if (list->secrets[i])
|
|
|
43fe83 |
virSecretFree(list->secrets[i]);
|
|
|
43fe83 |
--
|
|
|
43fe83 |
1.8.3.2
|
|
|
43fe83 |
|