Fix a memory leak in DtlsSocket where it was not calling X509_free(). Also remove some unused functions, get rid of C-style variable declaration.