I don’t have any legal advice, but maybe some helpful perspective.
When we return security deposits, we write the check to all tenants on the lease, such as “Tenant A or Tenant B”. If they did not provide a forwarding address we send it to the unit address, hoping they filed a change of address form. If not you will find it in the mailbox and can keep it until someone contacts you, or not.
If folks change tenants and updated rental agreement are signed, we make it clear that we do not deal with divvying out the security deposit. Our standard language states:
In the event that Tenants decide they no longer want to live together, ___________ will be considered the primary Tenant to make decisions about modifying or terminating tenancy. Deposits will not be returned (full or partial) until all tenants move out.
If Tenant A didn’t come to you to get part of the deposit back they may have gone to tenant B, but they most likely walked away from it and I feel it is between tenant A and B to sort it out.
Personally I would return it to tenant B, the active tenant in the current active contract.