Fix a mem leak on error in the PSK code