Wiktionary
vicarious punishment
n. (context psychology English) The punishment of somebody who has committed a certain act, in order to dissuade others from doing the same.