cipher: fix memory leaks.