When forgetting the named PIN, that has reference which is not equal to -1,
the corresponding named_pin entry is not set to NULL.
It concerns the PINs for which both 'named_pin' and '*secret_cache'
have an entry.
In my case it results in segmentation fault.
(I use in loop the pkcs15init library for the smartcard initialisation.)
Here is the patch that solves this problem for me.