Fix resource descriptor leaks.

CID: 966576 & 966577

OK from guenther@ and "Yup. looks good." from tedu@