Fix memory leaks in SSL statcks