From: Pavel Hrdina Date: Mon, 12 Oct 2020 17:54:36 +0000 (+0200) Subject: conf: virsecretobj: fix g_new0 allocation X-Git-Tag: v6.9.0-rc1~170 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=71a6522e4fb88b6112cb4df608fec920285c148c;p=thirdparty%2Flibvirt.git conf: virsecretobj: fix g_new0 allocation Fixes commit which changed allocation from VIR_ALLOC_N to g_new0 but missed one +1 on number of allocated elements. Signed-off-by: Pavel Hrdina Reviewed-by: Laine Stump --- diff --git a/src/conf/virsecretobj.c b/src/conf/virsecretobj.c index c98d52f1e4..d74deb9316 100644 --- a/src/conf/virsecretobj.c +++ b/src/conf/virsecretobj.c @@ -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);