Fixed smartcard related issues with double free.