Use CRYPTO_free to free the result of BN_bn2bin.