This answer is for educational purposes only. I work in criminal law and do not handle your type of case.
I would say that at the end of the 6 month lease, if you are wanting to release, 1/2 of the deposit should be returned to her. If I owned the apartment, I would return the entire deposit to you, made out to both of you, and then require you to make a new deposit to avoid getting in the middle of a lawsuit.
If I were you, I would ask the apartment complex to handle it this way, and I would go with the ex and cash the check together and have her take 1/2 of the money (with her signature on the back of the check.) Then I would make a new deposit and new lease only in your name that way she would not win if she tried to sue you or make a claim in the future. You do not want to find at the end of the lease that the apartment will not return the deposit because it is both of your names and they want a legal decision.
This is not legal advice but thoughts on how to handle the matters.