cURL

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker Archives

[curl:bugs] Re: #1368 cacertinmem.c sample memory leak

From: Marko <marknav_at_users.sf.net>
Date: Fri, 09 May 2014 07:55:36 +0000

Of course. Attached is a modified sample, search for text "LEAKFIX".

How to debug:
- cert->references is 1 before call to X509_STORE_add_cert, and 2 after a
call. So we need to call X509_free(cert) to decrease the cert->reference
back to 1 (referenced from X509 store).
- BIO_new_mem_buf returns new "bio" stream, BIO_free call is missing. BIO
objects are also reference counted, so BIO_free decreases the count to 0
and deletes the object.

Regards,
Marko

On Thu, May 8, 2014 at 11:08 PM, Daniel Stenberg <bagder_at_users.sf.net>wrote:

>
> - *assigned_to*: Daniel Stenberg
> - *Comment*:
>
> Thanks! Any chance you can provide a patch for your suggested fix?
> ------------------------------
>
> * [bugs:#1368] <http://sourceforge.net/p/curl/bugs/1368/> cacertinmem.c
> sample memory leak*
>
> *Status:* open
> *Created:* Thu May 08, 2014 01:47 PM UTC by Marko
> *Last Updated:* Thu May 08, 2014 01:48 PM UTC
> *Owner:* Daniel Stenberg
>
> While investigating a memory leak in our application, I discovered that
> "sslctx_function" callback that was implemented following the cacertinmem.c
> sample was causing it.
>
> After X509_STORE_add_cert, X509_free(cert) should be called, as
> X509_STORE_add_cert increments reference count. Also, BIO_free(bio) must be
> called.
> ------------------------------
>
> Sent from sourceforge.net because you indicated interest in
> https://sourceforge.net/p/curl/bugs/1368/
>
> To unsubscribe from further messages, please visit
> https://sourceforge.net/auth/subscriptions/
>

---
** [bugs:#1368] cacertinmem.c sample memory leak**
**Status:** open
**Created:** Thu May 08, 2014 01:47 PM UTC by Marko
**Last Updated:** Thu May 08, 2014 09:08 PM UTC
**Owner:** Daniel Stenberg
While investigating a memory leak in our application, I discovered that "sslctx_function" callback that was implemented following the cacertinmem.c sample was causing it.
After X509_STORE_add_cert, X509_free(cert) should be called, as X509_STORE_add_cert increments reference count. Also, BIO_free(bio) must be called.
---
Sent from sourceforge.net because curl-tracker@cool.haxx.se is subscribed to http://sourceforge.net/p/curl/bugs/
To unsubscribe from further messages, a project admin can change settings at http://sourceforge.net/p/curl/admin/bugs/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.
Received on 2014-05-09

These mail archives are generated by hypermail.

donate! Page updated March 21, 2014.
web site info

File upload with ASP.NET