The departing US president has used his last day in office to protect some of Donald Trump’s adversaries from potential revenge.