From: Daniel P. Berrangé Date: Tue, 19 May 2020 14:55:55 +0000 (+0100) Subject: src: don't use VIR_FREE on an object allocation X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=a771351ae49c0b8f5fce8664fd11345874b045d8;p=libvirt.git src: don't use VIR_FREE on an object allocation 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. Reviewed-by: Michal Privoznik Signed-off-by: Daniel P. Berrangé --- diff --git a/src/rpc/virnettlscontext.c b/src/rpc/virnettlscontext.c index 02c17124a1..a8104cf484 100644 --- a/src/rpc/virnettlscontext.c +++ b/src/rpc/virnettlscontext.c @@ -752,10 +752,7 @@ static virNetTLSContextPtr virNetTLSContextNew(const char *cacert, error: if (isServer) gnutls_dh_params_deinit(ctxt->dhParams); - if (ctxt->x509cred) - gnutls_certificate_free_credentials(ctxt->x509cred); - VIR_FREE(ctxt->priority); - VIR_FREE(ctxt); + virObjectUnref(ctxt); return NULL; }