Re: [libvirt PATCH 2/2] conf: virsecretobj: fix g_new0 allocation

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

 



On 10/12/20 2:13 PM, Pavel Hrdina wrote:
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@xxxxxxxxxx>
---
  src/conf/virsecretobj.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

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);

Reviewed-by: Laine Stump <laine@xxxxxxxxxx>




[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