From: Nikos Mavrogiannopoulos Date: Fri, 8 Apr 2011 15:27:54 +0000 (+0200) Subject: corrected memory leak on RSA signatures. X-Git-Tag: gnutls_2_99_0~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9bc4becb76eaa7a9367510f432906440784ccc9;p=thirdparty%2Fgnutls.git corrected memory leak on RSA signatures. --- diff --git a/lib/auth_cert.c b/lib/auth_cert.c index e6b2eee5fa..c760e50c02 100644 --- a/lib/auth_cert.c +++ b/lib/auth_cert.c @@ -1593,7 +1593,7 @@ _gnutls_gen_cert_client_cert_vrfy (gnutls_session_t session, gnutls_buffer_st * goto cleanup; } - return data->length; + ret = data->length; cleanup: _gnutls_free_datum (&signature); diff --git a/lib/gnutls_pk.c b/lib/gnutls_pk.c index 9fa032601b..f6284fd1c4 100644 --- a/lib/gnutls_pk.c +++ b/lib/gnutls_pk.c @@ -185,8 +185,8 @@ _gnutls_pkcs1_rsa_encrypt (gnutls_datum_t * ciphertext, if (ciphertext->data == NULL) { gnutls_assert (); - _gnutls_free_datum (&encrypted); - return GNUTLS_E_MEMORY_ERROR; + ret = GNUTLS_E_MEMORY_ERROR; + goto cleanup; } memcpy (&ciphertext->data[pad], encrypted.data, encrypted.size); @@ -195,9 +195,12 @@ _gnutls_pkcs1_rsa_encrypt (gnutls_datum_t * ciphertext, ciphertext->size = k; + ret = 0; + +cleanup: _gnutls_free_datum (&encrypted); - return 0; + return ret; }