Use secure memory by default
Fix memory leaks
Fix more memory leaks