Running an app that uses OpenSSL here through valgrind:

==10427== 6400 bytes in 200 blocks are definitely lost in loss record 4 of 4
==10427==    at 0x40029888: calloc (vg_replace_malloc.c:273)
==10427==    by 0x403C61C7: kssl_ctx_new (in /lib/libssl.so.0.9.7a)
==10427==    by 0x403B8AE7: SSL_new (in /lib/libssl.so.0.9.7a)

"ssl_lib.c" line 244 of 2315   function SSL_new()
#ifndef OPENSSL_NO_KRB5
        s->kssl_ctx = kssl_ctx_new();
#endif  /* OPENSSL_NO_KRB5 */



ssl_lib.c function SSL_free() does not appear to free this memory.

As a note, the system libraries here are openssl 0.9.7a, but I'm looking through the 0.9.7b source and the handling doesn't appear any different there.
In fact, kssl_ctx_free() isn't called from anywhere in ssl/*.c (it's commented out from one location).


Seems like a simple fix:

diff -up ssl_lib.c ../ssl-modified/ssl_lib.c
--- ssl_lib.c   2003-01-30 06:00:37.000000000 -0500
+++ ../ssl-modified/ssl_lib.c   2003-09-26 15:36:14.000000000 -0400
@@ -473,6 +473,10 @@ void SSL_free(SSL *s)

if (s->method != NULL) s->method->ssl_free(s);

+#ifndef        OPENSSL_NO_KRB5
+       if (s->kssl_ctx != NULL) kssl_ctx_free(s->kssl_ctx);
+#endif /* OPENSSL_NO_KRB5 */
+
        OPENSSL_free(s);
        }


Andrew


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to