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

[libvirt] [PATCH 2/4] virsh: free the list from ListAll APIs even for 0 items



virsh secret-list leak when no secrets are defined:

==27== 8 bytes in 1 blocks are definitely lost in loss record 6 of 726
==27==    by 0x4E941DD: virAllocN (viralloc.c:183)
==27==    by 0x5037F1A: remoteConnectListAllSecrets (remote_driver.c:3076)
==27==    by 0x5004EC6: virConnectListAllSecrets (libvirt.c:16298)
==27==    by 0x15F813: vshSecretListCollect (virsh-secret.c:397)
==27==    by 0x15F0E1: cmdSecretList (virsh-secret.c:532)

And so do some other *-list commands.

https://bugzilla.redhat.com/show_bug.cgi?id=1001536
---
 tools/virsh-interface.c | 2 +-
 tools/virsh-network.c   | 2 +-
 tools/virsh-nodedev.c   | 2 +-
 tools/virsh-nwfilter.c  | 2 +-
 tools/virsh-secret.c    | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c
index 0f78551..3720c8c 100644
--- a/tools/virsh-interface.c
+++ b/tools/virsh-interface.c
@@ -174,7 +174,7 @@ vshInterfaceListFree(vshInterfaceListPtr list)
 {
     size_t i;
 
-    if (list && list->nifaces) {
+    if (list && list->ifaces) {
         for (i = 0; i < list->nifaces; i++) {
             if (list->ifaces[i])
                 virInterfaceFree(list->ifaces[i]);
diff --git a/tools/virsh-network.c b/tools/virsh-network.c
index 06bf483..8ddd5ca 100644
--- a/tools/virsh-network.c
+++ b/tools/virsh-network.c
@@ -423,7 +423,7 @@ vshNetworkListFree(vshNetworkListPtr list)
 {
     size_t i;
 
-    if (list && list->nnets) {
+    if (list && list->nets) {
         for (i = 0; i < list->nnets; i++) {
             if (list->nets[i])
                 virNetworkFree(list->nets[i]);
diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c
index 5522405..b34a3b1 100644
--- a/tools/virsh-nodedev.c
+++ b/tools/virsh-nodedev.c
@@ -207,7 +207,7 @@ vshNodeDeviceListFree(vshNodeDeviceListPtr list)
 {
     size_t i;
 
-    if (list && list->ndevices) {
+    if (list && list->devices) {
         for (i = 0; i < list->ndevices; i++) {
             if (list->devices[i])
                 virNodeDeviceFree(list->devices[i]);
diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c
index fbf211a..e5fcb8f 100644
--- a/tools/virsh-nwfilter.c
+++ b/tools/virsh-nwfilter.c
@@ -242,7 +242,7 @@ vshNWFilterListFree(vshNWFilterListPtr list)
 {
     size_t i;
 
-    if (list && list->nfilters) {
+    if (list && list->filters) {
         for (i = 0; i < list->nfilters; i++) {
             if (list->filters[i])
                 virNWFilterFree(list->filters[i]);
diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c
index ac99840..e849a79 100644
--- a/tools/virsh-secret.c
+++ b/tools/virsh-secret.c
@@ -370,7 +370,7 @@ vshSecretListFree(vshSecretListPtr list)
 {
     size_t i;
 
-    if (list && list->nsecrets) {
+    if (list && list->secrets) {
         for (i = 0; i < list->nsecrets; i++) {
             if (list->secrets[i])
                 virSecretFree(list->secrets[i]);
-- 
1.8.1.5


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