Electromagnetism

A charged capacitor is connected across a resistor and allowed to discharge. What happens to the capacitor's stored electrostatic energy?