When real property is sold on execution or under judgment or mortgage, the purchaser thereof, or any person who has succeeded to the purchaser’s interest, after the estate becomes absolute, may recover damages for injury to the property by the tenant in possession after the sale, and before possession is delivered under the conveyance.