If I end my lease under this law, will I lose my security deposit?
Not necessarily. The same laws that apply to all tenants for security deposits apply to you as well.1 In general, a security deposit can be kept by a landlord, in whole or in part, to reimburse the landlord for damage you cause to the apartment (aside from ordinary "wear and tear"), cleaning, key replacement, or back rent owed.2 The landlord cannot decide to keep your security deposit to penalize you for breaking your lease under this law.
1 Cal.Civ.Code § 1946.7(d)
2 See CA Courts website