Fix memory leak in documentation generation.

RB=383405
R=sfaber,kparikh,si-dev,kvidhani,sha
A=sfaber,kvidhani