I think I might have an easy better solution. Instead of `TLSContainerStorage *`, make this a `Ptr<TLSContainerStorage>`, and change the result type to that, as well. Then store a copy of this `Ptr` in the `TLSDataContainer`. So the actual `TLSContainerStorage` will be deleted no earlier than all `TLSContainerStorage`s are destroyed.

Only problem is, it requires changing the layout of `TLSDataContainer`, which is a binary incompatible change, and I think it's in 2.4.8, so it can't be done in 2.4. Definitely something to consider for master, though.