[PATCH 1/4] storage: rbd: use VIR_REALLOC in the loop

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

 



If there are more than 16 images, the memory allocated in images
might be leaked on subsequent execution(s).

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 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 315bef2fee..d3056287df 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -620,7 +620,7 @@ virStorageBackendRBDGetVolNames(virStorageBackendRBDStatePtr ptr)
     size_t i;
 
     while (true) {
-        if (VIR_ALLOC_N(images, nimages) < 0)
+        if (VIR_REALLOC_N(images, nimages) < 0)
             goto error;
 
         rc = rbd_list2(ptr->ioctx, images, &nimages);
-- 
2.20.1

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

  Powered by Linux