From: Nikos Mavrogiannopoulos Date: Thu, 8 May 2014 17:46:51 +0000 (+0200) Subject: Avoid memory leak in safe renegotiation extension handling. X-Git-Tag: gnutls_3_3_3~83 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bf14f797a675e628d2abf573248fa29b95167f80;p=thirdparty%2Fgnutls.git Avoid memory leak in safe renegotiation extension handling. The memory leak was uncovered by the Codenomicon TLS suite. --- diff --git a/lib/ext/safe_renegotiation.c b/lib/ext/safe_renegotiation.c index 8975641417..314c4e2749 100644 --- a/lib/ext/safe_renegotiation.c +++ b/lib/ext/safe_renegotiation.c @@ -294,8 +294,13 @@ _gnutls_sr_recv_params(gnutls_session_t session, return GNUTLS_E_MEMORY_ERROR; } epriv.ptr = priv; - } else + + _gnutls_ext_set_session_data(session, + GNUTLS_EXTENSION_SAFE_RENEGOTIATION, + epriv); + } else { priv = epriv.ptr; + } /* It is not legal to receive this extension on a renegotiation and * not receive it on the initial negotiation. @@ -322,10 +327,6 @@ _gnutls_sr_recv_params(gnutls_session_t session, priv->safe_renegotiation_received = 1; priv->connection_using_safe_renegotiation = 1; - if (set != 0) - _gnutls_ext_set_session_data(session, - GNUTLS_EXTENSION_SAFE_RENEGOTIATION, - epriv); return 0; }