OpenPGP: re-factor pgp_finish()
OpenPGP: re-factor pgp_finish()

Re-structure pgp_finish() for easier reading.
While at it, check for priv != NULL before free()ing it.

Signed-off-by: Peter Marschall <peter@adpm.de>

git-svn-id: 444ed946b9c2220da791e84c3dd156a05f92db99@5486 c6295689-39f2-0310-b995-f0e70906c6a9

adminmt/OpenSC,aobaid/OpenSC,dirkx/OpenSC,dirkx/OpenSC.tokend,AktivCo/OpenSC,dengert/OpenSC,velter/OpenSC,marschap/pkg-opensc,hongquan/OpenSC-main,fabled/OpenSC,marschap/pkg-opensc,gentoo/OpenSC,gentoo/OpenSC,UIKit0/OpenSC,ieugen/OpenSC,carlhoerberg/OpenSC,mtrojnar/OpenSC,LudovicRousseau/OpenSC,jpki/OpenSC,0x7678/myOpenSC,OpenSC/OpenSC,adminmt/OpenSC,frankmorgner/OpenSC,0x7678/OpenSC,carlhoerberg/OpenSC,kasparsd/opensc-latvia-id,gemini/OpenSC,frankmorgner/OpenSC,dirkx/OpenSC,germanblanco/OpenSC,velter/OpenSC,financeX/OpenSC,mouse07410/OpenSC,nmav/OpenSC,carlhoerberg/OpenSC,AktivCo/OpenSC,dirkx/OpenSC,fabled/OpenSC,Jakuje/OpenSC,Jakuje/OpenSC,viktorTarasov/OpenSC-SM,dirkx/OpenSC.tokend,jpki/OpenSC,dirkx/OpenSC.tokend,aobaid/OpenSC,dengert/OpenSC,rickyepoderi/OpenSC,adminmt/OpenSC,0x7678/OpenSC,frankmorgner/OpenSC,UIKit0/OpenSC,rickyepoderi/OpenSC,Jakuje/OpenSC,ieugen/OpenSC,financeX/OpenSC,UIKit0/OpenSC,mouse07410/OpenSC,CardContact/OpenSC,aobaid/OpenSC,UIKit0/OpenSC,ieugen/OpenSC,dirkx/OpenSC.tokend,carlhoerberg/OpenSC,fabled/OpenSC,hhonkanen/OpenSC,rickyepoderi/OpenSC,metsma/OpenSC,germanblanco/OpenSC,viktorTarasov/OpenSC-SM,gentoo/OpenSC,l1k/OpenSC,adminmt/OpenSC,marschap/pkg-opensc,kasparsd/opensc-latvia-id,hongquan/OpenSC-main,frankmorgner/OpenSC,aobaid/OpenSC,financeX/OpenSC,fabled/OpenSC,tidatida/OpenSC,hhonkanen/OpenSC,Jakuje/OpenSC,carlhoerberg/OpenSC,0x7678/myOpenSC,philipWendland/OpenSC,LudovicRousseau/OpenSC,martinpaljak/OpenSC,hhonkanen/OpenSC,OpenSC/OpenSC,CardContact/OpenSC,0x7678/myOpenSC,hongquan/OpenSC-main,jpki/OpenSC,metsma/OpenSC,gentoo/OpenSC,financeX/OpenSC,velter/OpenSC,0x7678/OpenSC,0x7678/OpenSC,gemini/OpenSC,OpenSC/OpenSC,martinpaljak/OpenSC,dirkx/OpenSC.tokend,mtrojnar/OpenSC,mtrojnar/OpenSC,philipWendland/OpenSC,martinpaljak/OpenSC,dirkx/OpenSC,velter/OpenSC,l1k/OpenSC,dirkx/OpenSC,financeX/OpenSC,nmav/OpenSC,metsma/OpenSC,0x7678/myOpenSC,CardContact/OpenSC,tidatida/OpenSC,germanblanco/OpenSC,marschap/pkg-opensc,ieugen/OpenSC,tidatida/OpenSC,gentoo/OpenSC,kasparsd/opensc-latvia-id,nmav/OpenSC,AktivCo/OpenSC,l1k/OpenSC,tidatida/OpenSC,0x7678/myOpenSC,LudovicRousseau/OpenSC,mouse07410/OpenSC,dirkx/OpenSC.tokend,philipWendland/OpenSC,gemini/OpenSC,dengert/OpenSC,viktorTarasov/OpenSC-SM,kasparsd/opensc-latvia-id,ieugen/OpenSC