http://bugs.winehq.org/show_bug.cgi?id=27168
--- Comment #27 from Juan Lang juan_lang@yahoo.com 2011-09-18 12:28:42 CDT --- (In reply to comment #24)
Just an idea - currently Context_Release accepts a dataContextFree pointer to a function which will free a data context once its reference count is down to 0. Now we need some way to free a certStore when reference counter on a link in that store is down to 0. Is adding something like linkContextFree a good idea?
linkContextFree implies it'd only be done on link contexts? I don't think that's true. I think you need to increment the ref count of a cert's (/CRL's/CTL's) store when returning a cert (/CRL/CTL) from the store, e.g. from CertEnumCertificatesInStore, and decrement the store's ref count when freeing it. The difficulty comes in cascading the ref count to all the stores the cert is in, e.g. if the store is part of a collection. That's really pretty complicated, because collections know which stores are part of them, but stores do not know which stores they belong to.