Committed with a ChangeLog entry and a small change. Another beer? :-) Thanks! Giuseppe
Gijs van Tulder <gvtul...@gmail.com> writes: > Hi, > > I think there is a memory leak in the GnuTLS part of wget. When > downloading multiple files from a HTTPS server, wget with GnuTLS uses > a lot of memory. > > Perhaps an explanation for this can be found in src/http.c. The > gethttp calls ssl_init for each download: > >> /* Initialize the SSL context. After this has once been done, >> it becomes a no-op. */ >> if (!ssl_init ()) > > The OpenSSL version of ssl_init, in src/openssl.c, checks if SSL has > already been initialized and doesn't repeat the work. > > But the GnuTLS version doesn't: > >> bool >> ssl_init () >> { >> const char *ca_directory; >> DIR *dir; >> >> gnutls_global_init (); >> gnutls_certificate_allocate_credentials (&credentials); > > GnuTLS is initialized again and again, but there is never a call to > gnutls_global_deinit. > > I've attached a small patch to add a check to ssl_init in > src/gnutls.c, similar to the check already in src/openssl.c. With it, > wget can still download over HTTPS and the memory usage stays within > reasonable limits. > > Thanks, > > Gijs