From a86a87fc28aee52af46f75ad13e4638e00e06b34 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Fri, 12 Jul 2019 16:11:16 +0200
Subject: [PATCH] storage: rbd: actually index the array when iterating over it
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

https://bugzilla.redhat.com/show_bug.cgi?id=1729292

Fixes: 3aa190f2a43a632b542a6ba751a6c3ab4d51f1dd
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry-picked from commit 9b7c4048fa0559fd81d57b7f7d13b1dccd6a99b2)
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
 src/storage/storage_backend_rbd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index d305628..1cb447c 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -637,7 +637,7 @@ virStorageBackendRBDGetVolNames(virStorageBackendRBDStatePtr ptr)
     nnames = nimages;
 
     for (i = 0; i < nimages; i++)
-        VIR_STEAL_PTR(names[i], images->name);
+        VIR_STEAL_PTR(names[i], images[i]->name);
 
     return names;
 
-- 
2.19.1

