mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-29 03:51:17 +00:00
virGetConnectGeneric: Fix memleak of 'identparams' when connecting between split daemons
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@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
45064119c1
commit
decc03857f
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user