Fix memleaks in docs2harvest
Closes #20