Memory leak in SChannel SSL code


I've just had a memory leak in the SChannel SSL code reported by a client. It's a fairly fundamental leak has highlighted an omission in the mock buffer allocators that I use to test this kind of code; it also highlights that the SChannel code was somewhat rushed to release before Christmas.

I'm working on a fix now and the changes will be included in the 5.2.5 release of the SChannel code. Right now there are only a few clients with the SChannel code anyway and none of you have 5.2.5 and so I'm folding this fix into that release rather than doing a 5.2.6 release.

The problem in my tests is that although my mock buffers and mock buffer allocators allow you to see when the code under test is performing operations on buffers (including reference counting operations) they didn't (until today) clearly inform you when the final reference was released on a particular buffer. So the tests COULD have checked that there were the right number of releases to ensure that no buffers were leaked but that's somewhat fragile. Now the mock buffers and allocators clearly report when a buffer is destroyed due to the final reference being released and this makes it easy to check for this situation in the appropriate places within the tests.

Expect the updated release later today or tomorrow.

Leave a comment