Fix memory management in SIM/AKA crypto functions