Memory allocated using g_object_new must never be released using
VIR_FREE/g_free because g_object_new uses a special allocation
strategy internally.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/rpc/virnettlscontext.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/rpc/virnettlscontext.c b/src/rpc/virnettlscontext.c
index 02c17124a1..ced0cbdcd8 100644
--- a/src/rpc/virnettlscontext.c
+++ b/src/rpc/virnettlscontext.c
@@ -750,12 +750,9 @@ static virNetTLSContextPtr virNetTLSContextNew(const char *cacert,
return ctxt;
error:
+ virObjectUnref(ctxt);
if (isServer)
gnutls_dh_params_deinit(ctxt->dhParams);
- if (ctxt->x509cred)
- gnutls_certificate_free_credentials(ctxt->x509cred);
- VIR_FREE(ctxt->priority);
- VIR_FREE(ctxt);
return NULL;
}
--
2.24.1