Commit 4302c6bd authored by Guillaume Roguez's avatar Guillaume Roguez
Browse files

sips: fix memory leak

This patch fixes a memory leak in SipsIceTransport class.
gnutls_priority_init() allocates memory, no gnutls_priority_deinit()
is called to free it.
This last has been added in SipsIceTransport destructor.
This patch also fixes code rules error on priority_cache_ naming
(this is the variable initialized by gnutls_priority_init).

Change-Id: I32a8a7347d4af96886a0def2d9a6d77fe0fad7c7
Tuleap: #92
parent 8f9db001
......@@ -177,7 +177,7 @@ SipsIceTransport::SipsIceTransport(pjsip_endpoint* endpt,
if (pjsip_transport_register(base.tpmgr, &base) != PJ_SUCCESS)
throw std::runtime_error("Can't register PJSIP transport.");
gnutls_priority_init(&priority_cache,
gnutls_priority_init(&priority_cache_,
"SECURE192:-VERS-TLS-ALL:+VERS-DTLS-ALL:%SERVER_PRECEDENCE",
nullptr);
......@@ -219,6 +219,8 @@ SipsIceTransport::~SipsIceTransport()
pj_lock_destroy(trData_.base.lock);
pj_atomic_destroy(trData_.base.ref_cnt);
gnutls_priority_deinit(priority_cache_);
}
pj_status_t
......@@ -237,7 +239,7 @@ SipsIceTransport::startTlsSession()
gnutls_session_set_ptr(session_, this);
gnutls_transport_set_ptr(session_, this);
gnutls_priority_set(session_, priority_cache);
gnutls_priority_set(session_, priority_cache_);
/* Allocate credentials for handshaking and transmission */
gnutls_certificate_credentials_t certCred;
......
......@@ -129,7 +129,7 @@ private:
gnutls_session_t session_ {nullptr};
std::unique_ptr<gnutls_certificate_credentials_st, decltype(gnutls_certificate_free_credentials)&> xcred_;
gnutls_priority_t priority_cache;
gnutls_priority_t priority_cache_ {nullptr};
gnutls_datum_t cookie_key_ {nullptr, 0};
gnutls_dtls_prestate_st prestate_;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment