The 'identparams' typed parameter list obtained from
virIdentityGetParameters is leaked when called from
'virGetConnectGeneric'.
Use 'virTypedParamListFromParams' to absorb it into a virTypedParamList
which can be autofreed.
Note that the memleak is observable only when running in split-daemon
mode.
Closes:
https://gitlab.com/libvirt/libvirt/-/issues/314
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/driver.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/driver.c b/src/driver.c
index 41b4f0055b..d4136c438f 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -36,6 +36,7 @@
#include "viridentity.h"
#include "datatypes.h"
#include "configmake.h"
+#include "virtypedparam.h"
VIR_LOG_INIT("driver");
@@ -159,6 +160,7 @@ virGetConnectGeneric(virThreadLocal *threadPtr, const char *name)
if (conn->driver->connectSetIdentity != NULL) {
g_autoptr(virIdentity) ident = NULL;
+ g_autoptr(virTypedParamList) paramlist = NULL;
virTypedParameterPtr identparams = NULL;
int nidentparams = 0;
@@ -169,7 +171,9 @@ virGetConnectGeneric(virThreadLocal *threadPtr, const char *name)
if (virIdentityGetParameters(ident, &identparams, &nidentparams) <
0)
goto error;
- if (virConnectSetIdentity(conn, identparams, nidentparams, 0) < 0)
+ paramlist = virTypedParamListFromParams(&identparams, nidentparams);
+
+ if (virConnectSetIdentity(conn, paramlist->par, paramlist->npar, 0)
< 0)
goto error;
}
}
--
2.35.3