[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] Memory leak when using GnuTLS

From: Giuseppe Scrivano
Subject: Re: [Bug-wget] Memory leak when using GnuTLS
Date: Fri, 04 Nov 2011 22:35:24 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.90 (gnu/linux)

Committed with a ChangeLog entry and a small change.  Another beer? :-)


Gijs van Tulder <address@hidden> 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]