crypto: fix mem leak