Thanks to you all, So, I understand that when I am adding cert to the store, I should explicilty increment the count using CRYPTO_add, so that when I X509_STORE_free(), it doesn't delete my cert. This should be enough. Thanks & Regards, Nayna Jain From: Thulasi Goriparthi <thulasi.goriparthi@xxxxxxxxx> To: "openssl-users at openssl org" <openssl-users at openssl.org> Date: 06/10/2015 06:57 PM Subject: Re: [openssl-users] X509_STORE_free() and X509_LOOKUP_free() also frees the X509 certificates inside it Sent by: "openssl-users" <openssl-users-bounces at openssl.org> On 10 June 2015 at 18:45, Viktor Dukhovni <openssl-users at dukhovni.org> wrote: On Wed, Jun 10, 2015 at 04:11:45PM +0530, Thulasi Goriparthi wrote: > Jakob is saying that if you want them to stay even after X509_STORE_free, > explicitly increment the ref count before calling free using something like > below. > > CRYPTO_add(certificate->references, 1, CRYPTO_LOCK_X509); That should be: ? ? CRYPTO_add(&certificate->references, 1, CRYPTO_LOCK_X509); the references parameter should be a pointer. Thank you for the correction. -- ? ? ? ? Viktor. _______________________________________________ openssl-users mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users _______________________________________________ openssl-users mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150611/c254fe2e/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: graycol.gif Type: image/gif Size: 105 bytes Desc: not available URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150611/c254fe2e/attachment.gif>