[sr-dev] [kamailio/kamailio] ims_registrar_scscf: fix memleaks, minor refactors (PR #3787)