Under most circumstances, the tenant of an apartment can not use the amount of the security deposit for last months rent unless you get permission from the landlord. Withholding a portion of the rent claiming security deposit should make up the difference is a violation of the lease terms and the landlord is protected. If the tenant does this, the landlord has the right to sue for three times the amount withheld, plus attorney fees and court costs to take the tenant to court. However, if the landlord and tenant agree to terminate the lease under the repair law, the tenant may put the security deposit towards the last months rent.
Information from the Austin Tenants Council website.