Hi, today many people using our program faced with strange crashes and problems. Digging into it we found that it's because json upgrade Following is simple program built using "g++ main.cpp -ljson-c"
#include <stdio.h> #include <json-c/json.h> int main() { const char* json = R"({"SyncResponse":{"status":"success","StreamCheckerMode":false,"UniqueVisitors":false,"RoutesHash":"","Routes":[],"IpRanges":[],"ServerAuthorizationProperties":{"ServerAuthPropertiesHash":""},"CamerasHash":"","Cameras":[],"StreamsHash":"","Streams":[],"RtmpSettings":{"hash":"1589511271996","interfaces":[{"ip":"172.16.3.100","port":1935,"ssl":false}],"login":"","password":"","duration":6,"chunk_count":4,"hls_part_duration":1000,"dash_template":"NUMBER","generate_icecast_metadata":true,"protocols":["HLS","RTMP","MPEG2TS","ICECAST","DASH","RTSP","SLDP"],"apps":[{"app":"local","login":"root","password":"psw","duration":6,"chunk_count":4,"hls_part_duration":1000,"dash_template":"TIME","generate_icecast_metadata":true,"protocols":["HLS","RTMP","MPEG2TS","ICECAST","DASH","RTSP","SLDP"]}],"abr":[]},"RtspSettings":{"hash":"1589502370997","interfaces":[]},"IcecastSettings":{"hash":"1589502373053","interfaces":[]},"LivePullSettings":{"hash":"1589502491133","streams":[]},"RtmpPublishSettings":{"hash":"1589502499024","settings":[]},"RtspPublishSettings":{"hash":"1589502497581","settings":[]},"ManagedTasks": {"hash":"0", "tasks": []},"HlsDRMSettings": {"hash":"0", "url":"", "key":"", "KeyServerSettings": {}},"HttpOriginApps":{"hash":"0","apps":[]},"Aliases":{"hash":"0","settings":[]},"DataSlicesInfo":{"hash":"1","data_slices":[{"id":"54118","tz":0}]},"UDPSenderSettings":{"hash":"0","settings":[]},"PayPerPublishSettings":{"hash":"0","url":"","auth_group_interval":500,"apps":[]},"DvrSettings":{"hash":"1589502502894","settings":[]},"UserAgentGroupSettings":{"hash":"0","settings":[]},"RefererGroupSettings":{"hash":"0","settings":[]},"VideoEncodersInfo":{"hash":"0","encoders":[]},"AudioEncodersInfo":{"hash":"0","encoders":[]},"StreamOverrideSettings":{"hash":"0","settings":[]},"IcecastStreamSettings": {"hash":"1589502513135","settings": []},"AuthHandlerSettings":{"hash":""},"ServerSettings":{"MaxCacheSize":64,"MaxFileCacheSize":4096,"LogMode":"debug"}}})"; json_object *rules = json_tokener_parse(json); if(!rules) { return -1; } printf("json parsed\n"); json_object_put(rules); return 0; } if I run it when latest "libjson-c3:amd64 0.12.1-1.3ubuntu0.1" installed on my ubuntu 18.04 I get crash with "lh_table_new: calloc failed" message but if I downgrade to previous libjson-c3:amd64 0.12.1-1.3 it works fine