]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
storage: rbd: use VIR_REALLOC in the loop
authorJán Tomko <jtomko@redhat.com>
Fri, 12 Jul 2019 14:09:32 +0000 (16:09 +0200)
committerJán Tomko <jtomko@redhat.com>
Fri, 12 Jul 2019 15:09:42 +0000 (17:09 +0200)
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@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/storage/storage_backend_rbd.c

index 315bef2feeb0b677c07ce0145deb25f24cf8fa5c..d3056287dfbcb8fe2701850b446a5dc3dc8527f1 100644 (file)
@@ -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);