mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
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:
parent
062b4a4cd7
commit
d43bc53edd
@ -620,7 +620,7 @@ virStorageBackendRBDGetVolNames(virStorageBackendRBDStatePtr ptr)
|
|||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (VIR_ALLOC_N(images, nimages) < 0)
|
if (VIR_REALLOC_N(images, nimages) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
rc = rbd_list2(ptr->ioctx, images, &nimages);
|
rc = rbd_list2(ptr->ioctx, images, &nimages);
|
||||||
|
Loading…
Reference in New Issue
Block a user