crypto: fix memleak on non-buffer