Ensure BIGNUM is freed in an error path