Detected by Coverity. Freeing the wrong variable results in both
a memory leak and the likelihood of the caller dereferencing through
a freed pointer.
* src/rpc/virnettlscontext.c (virNetTLSSessionNew): Free correct
variable.
virNetTLSSessionPtr sess;
int err;
- VIR_DEBUG("ctxt=%p hostname=%s isServer=%d", ctxt, NULLSTR(hostname), ctxt->isServer);
+ VIR_DEBUG("ctxt=%p hostname=%s isServer=%d",
+ ctxt, NULLSTR(hostname), ctxt->isServer);
if (VIR_ALLOC(sess) < 0) {
virReportOOMError();
if (virMutexInit(&sess->lock) < 0) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Failed to initialized mutex"));
- VIR_FREE(ctxt);
+ VIR_FREE(sess);
return NULL;
}