]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: virsecretobj: fix g_new0 allocation
authorPavel Hrdina <phrdina@redhat.com>
Mon, 12 Oct 2020 17:54:36 +0000 (19:54 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Tue, 13 Oct 2020 07:10:11 +0000 (09:10 +0200)
Fixes commit <d5b05614dfbc9bd60ea1a31a9cc32aaf3c771ddc> which changed
allocation from VIR_ALLOC_N to g_new0 but missed one +1 on number of
allocated elements.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
src/conf/virsecretobj.c

index c98d52f1e49578bd42aac1410a3580cadf986ccc..d74deb93166ab59850bcd6be258cda1137d85755 100644 (file)
@@ -588,7 +588,7 @@ virSecretObjListExport(virConnectPtr conn,
 
     virObjectRWLockRead(secretobjs);
     if (secrets)
-        data.secrets = g_new0(virSecretPtr, virHashSize(secretobjs->objs));
+        data.secrets = g_new0(virSecretPtr, virHashSize(secretobjs->objs) + 1);
 
     virHashForEach(secretobjs->objs, virSecretObjListExportCallback, &data);
     virObjectRWUnlock(secretobjs);