pkcs11-tool: Avoid double free and check allocation
pkcs11-tool: Avoid double free and check allocation

366349 Double free

Thanks coverity

OpenSC/OpenSC,Jakuje/OpenSC,frankmorgner/OpenSC,metsma/OpenSC,dengert/OpenSC,Jakuje/OpenSC,metsma/OpenSC,dengert/OpenSC,philipWendland/OpenSC,OpenSC/OpenSC,Jakuje/OpenSC,metsma/OpenSC,frankmorgner/OpenSC,OpenSC/OpenSC,LudovicRousseau/OpenSC,dengert/OpenSC,fabled/OpenSC,fabled/OpenSC,LudovicRousseau/OpenSC,mouse07410/OpenSC,fabled/OpenSC,mouse07410/OpenSC,fabled/OpenSC,mouse07410/OpenSC,frankmorgner/OpenSC,philipWendland/OpenSC,LudovicRousseau/OpenSC,philipWendland/OpenSC,Jakuje/OpenSC,frankmorgner/OpenSC