From: Ján Tomko Date: Fri, 12 Jul 2019 14:09:32 +0000 (+0200) Subject: storage: rbd: use VIR_REALLOC in the loop X-Git-Tag: v5.6.0-rc1~251 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d43bc53eddd49c8c22cb52f8b6554e1f7d4216f8;p=thirdparty%2Flibvirt.git 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 Reviewed-by: Daniel P. Berrangé --- 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);