git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* SSL_CTX leak?
@ 2014-03-27 13:37 Thiago Farina
  2014-03-27 23:11 ` Jeff King
  0 siblings, 1 reply; 3+ messages in thread
From: Thiago Farina @ 2014-03-27 13:37 UTC (permalink / raw)
  To: Git Mailing List

Hi,

Do we leak the context we allocate in imap-send.c:280 intentionally?

Regards,

--
Thiago Farina

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: SSL_CTX leak?
  2014-03-27 13:37 SSL_CTX leak? Thiago Farina
@ 2014-03-27 23:11 ` Jeff King
  2014-03-28 17:23   ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff King @ 2014-03-27 23:11 UTC (permalink / raw)
  To: Thiago Farina; +Cc: Git Mailing List

On Thu, Mar 27, 2014 at 10:37:07AM -0300, Thiago Farina wrote:

> Do we leak the context we allocate in imap-send.c:280 intentionally?

It was never mentioned on the mailing list when the patches came
originally, so I suspect is just an omission.

Presumably the SSL_CTX is needed by the connection that survives after
the function, but my reading of SSL_CTX_free implies that the data is
reference-counted, and the library would presumably handle it fine.

OTOH, it is probably not causing a huge problem (since we wouldn't end
up freeing it until the end of the program anyway), so I would not
personally devote to many brain cycles to figuring out how OpenSSL
handles it.

-Peff

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: SSL_CTX leak?
  2014-03-27 23:11 ` Jeff King
@ 2014-03-28 17:23   ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2014-03-28 17:23 UTC (permalink / raw)
  To: Jeff King; +Cc: Thiago Farina, Git Mailing List

Jeff King <peff@peff.net> writes:

> On Thu, Mar 27, 2014 at 10:37:07AM -0300, Thiago Farina wrote:
>
>> Do we leak the context we allocate in imap-send.c:280 intentionally?
>
> It was never mentioned on the mailing list when the patches came
> originally, so I suspect is just an omission.
>
> Presumably the SSL_CTX is needed by the connection that survives after
> the function, but my reading of SSL_CTX_free implies that the data is
> reference-counted, and the library would presumably handle it fine.

Yes, I was reading the SSL_new() yesterday and found out that at
least in a recent code it increments the reference count on the ctx
it is fed.  So it would be the right thing to decrement the refcount
in the caller that created the context and used to call SSL_new(),
but I fully agree with the analysis below (with s/a huge/any/):

> OTOH, it is probably not causing a huge problem (since we wouldn't end
> up freeing it until the end of the program anyway), so I would not
> personally devote to many brain cycles to figuring out how OpenSSL
> handles it.

Heh.  So you are saying that I wasted 30 minutes yesterday? ;-)

Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-28 17:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-27 13:37 SSL_CTX leak? Thiago Farina
2014-03-27 23:11 ` Jeff King
2014-03-28 17:23   ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).