Ask either guard: "If I asked the other guard which door leads to freedom, which door would he point to?" Then choose the opposite door from the one he indicates.
Why it works: there are two cases.
If you ask the truth-teller, he honestly reports what the liar would say. The liar would lie and point to the death door, so the truth-teller points to death.
If you ask the liar, he must lie about what the truth-teller would say. The truth-teller would point to the freedom door, but the liar falsely reports the death door.
Either way, the answer you get points to the death door. So you simply walk through the other one.
The trick is that the question stacks two layers of honesty or deception. Exactly one of the two guards is a liar, so the answer is always flipped once, no matter whom you ask. That makes it reliable even though you don't know which guard is which.
A simpler variant, if you prefer: ask "Would you say this door leads to freedom?" while pointing at a door. That also works with a double-negation structure, but the standard version above is the classic.