Any person who has lawfully entered a house for the purpose of making an arrest, may break open the door or window thereof if detained therein, when necessary for the purpose of liberating himself, and an officer may do the same, when necessary for the purpose of liberating a person who, acting in his aid, lawfully entered for the purpose of making an arrest, and is detained therein.
Ca. Pen. Code § 845