the lesser of two evils idiom
两害相权之轻者
the less unpleasant of two choices, neither of which is good
But allowing a criminal to go free is perhaps the lesser of two evils if the alternative is imprisoning an innocent person. 放走一个罪犯也许比把一个无辜者关进监狱要好一些。