A Stockton man accused of murdering a drug addict had been out of prison for less than 24 hours before he was caught up in the fatal violence, a court heard.