[PATCH 1/3] qemuBlockBitmapsHandleCommitStart: Fix allocation of string list

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

 



Allocate space also for the terminating NULL.

Reported-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index cc2edff5e0..115682c39d 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -3021,7 +3021,7 @@ qemuBlockBitmapsHandleCommitStart(virStorageSourcePtr topsrc,
     if (!(entry = virHashLookup(blockNamedNodeData, basesrc->nodeformat)))
         return 0;

-    bitmaplist = g_new0(char *, entry->nbitmaps);
+    bitmaplist = g_new0(char *, entry->nbitmaps + 1);

     for (i = 0; i < entry->nbitmaps; i++) {
         qemuBlockNamedNodeDataBitmapPtr bitmap = entry->bitmaps[i];
-- 
2.24.1





[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