Fixed memory leaks

Prior implementation did not call cJSON_Delete after creating and then finishing with CJSON objects. This lead to many memory leaks.