qemuBlockBitmapsHandleCommitStart: Fix allocation of string list

Allocate space also for the terminating NULL.

Reported-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Tested-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Peter Krempa 2020-03-17 15:10:23 +01:00
parent b8a3ed957e
commit 061057e754

View File

@ -3021,7 +3021,7 @@ qemuBlockBitmapsHandleCommitStart(virStorageSourcePtr topsrc,
if (!(entry = virHashLookup(blockNamedNodeData, basesrc->nodeformat))) if (!(entry = virHashLookup(blockNamedNodeData, basesrc->nodeformat)))
return 0; return 0;
bitmaplist = g_new0(char *, entry->nbitmaps); bitmaplist = g_new0(char *, entry->nbitmaps + 1);
for (i = 0; i < entry->nbitmaps; i++) { for (i = 0; i < entry->nbitmaps; i++) {
qemuBlockNamedNodeDataBitmapPtr bitmap = entry->bitmaps[i]; qemuBlockNamedNodeDataBitmapPtr bitmap = entry->bitmaps[i];