fixed memleaks in libjson