storage: rbd: use VIR_REALLOC in the loop

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>
This commit is contained in:
Ján Tomko 2019-07-12 16:09:32 +02:00
parent 062b4a4cd7
commit d43bc53edd

View 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);