Plug memory leak in mbedTLS backend
PATCH 1/1 Plug memory leak in mbedTLS backend
Signed-off-by Ivo Manca <[email protected]...>
--- src/openvpn/ssl_verify_polarssl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
src/openvpn/ssl_verify_polarssl.c +5 -2
@@ -137,7 +137,7 @@ backend_x509_get_serial (openvpn_x509_cert_t *cert, struct gc_arena *gc)if (!polar_ok (mpi_read_binary (&serial_mpi, cert->serial.p, cert->serial.len))) {msg (M_WARN ,"Failed to retrieve serial from certificate." ); -return NULL ; + goto end; }/* Determine decimal representation length, allocate buffer */
@@ -148,9 +148,12 @@ backend_x509_get_serial (openvpn_x509_cert_t *cert, struct gc_arena *gc)if (!polar_ok (mpi_write_string (&serial_mpi,10 , buf, &buflen))) {msg (M_WARN ,"Failed to write serial to string." ); -return NULL ; + buf =NULL ; + goto end; } +end: +mpi_free (&serial_mpi);return buf; }
Signature · 1 line
2.7.4
Quoted 21 lines · Ivo Manca
Signed-off-by Ivo Manca <[email protected]...>--- src/openvpn/ssl_verify_polarssl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)src/openvpn/ssl_verify_polarssl.c +1
-1@@ -137,7 +137,7 @@ backend_x509_get_serial (openvpn_x509_cert_t *cert, struct gc_arena *gc)if (!polar_ok (mpi_read_binary (&serial_mpi, cert->serial.p, cert->serial.len))) {msg (M_WARN ,"Failed to retrieve serial from certificate." ); -return NULL ; + goto end; }/* Determine decimal representation length, allocate buffer */ @@ -148,9 +148,12 @@ backend_x509_get_serial (openvpn_x509_cert_t *cert, struct gc_arena *gc)if (!polar_ok (mpi_write_string (&serial_mpi,10 , buf, &buflen))) {
src/openvpn/ssl_verify_polarssl.c backend_x509_get_serial (openvpn_x509_cert_t *cert, struct gc_arena *gc) · line 158
Quoted 10 lines
src/openvpn/ssl_verify_polarssl.c +4
-1msg (M_WARN ,"Failed to write serial to string." ); -return NULL ; + buf =NULL ; + goto end; } +end: +mpi_free (&serial_mpi);return buf; }
ACK - *but* Ivo did this work for us (Fox-IT), so some external eyes before applying are welcome.
-Steffan
Am 31.05.16 um 14:22 schrieb Steffan Karger:
Quoted 28 lines · Ivo Manca
Quoted 27 lines
Signed-off-by Ivo Manca <[email protected]...>--- src/openvpn/ssl_verify_polarssl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)src/openvpn/ssl_verify_polarssl.c +3
-2@@ -137,7 +137,7 @@ backend_x509_get_serial (openvpn_x509_cert_t *cert, struct gc_arena *gc)if (!polar_ok (mpi_read_binary (&serial_mpi, cert->serial.p, cert->serial.len))) {msg (M_WARN ,"Failed to retrieve serial from certificate." ); -return NULL ; + goto end; }/* Determine decimal representation length, allocate buffer */ @@ -148,9 +148,12 @@ backend_x509_get_serial (openvpn_x509_cert_t *cert, struct gc_arena *gc)if (!polar_ok (mpi_write_string (&serial_mpi,10 , buf, &buflen))) {msg (M_WARN ,"Failed to write serial to string." ); -return NULL ; + buf =NULL ; + goto end; }
Quoted 8 lines
src/openvpn/ssl_verify_polarssl.c backend_x509_get_serial (openvpn_x509_cert_t *cert, struct gc_arena *gc) · line 158
Quoted 4 lines
src/openvpn/ssl_verify_polarssl.c +2
-0+end: +mpi_free (&serial_mpi);return buf; }ACK - *but* Ivo did this work for us (Fox-IT), so some external eyes before applying are welcome.
ACK, looks good to me, too.
Arne
From: David Sommerseth <[email protected]...>
Your patch has been applied to the release/2.3 branch.
commit 8b3b74a04d89350f4cca54a80d15a759c5df5097
Author: Ivo Manca Date: Tue May 31 13:42:33 2016 +0200
Plug memory leak in mbedTLS backend
Signed-off-by: Ivo Manca <[email protected]...>
Acked-by: Steffan Karger <[email protected]...>
Acked-by: Arne Schwabe <[email protected]...>
Message-Id: <[email protected]...>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11752
Signed-off-by: David Sommerseth <[email protected]...>--
kind regards,
David Sommerseth