api: upgrade cjson and fix realloc