registar: proper unlinking deleted contact to avoid invalid memory access

- based on a report and patch by Dragos Oancea