@cryptotaxi247 / netdata-1 / commits / f197e2d99

Coverity 20190924 (#6941)

* coverity_20190924: Fix 215633 In the switch the library stops case this pointer is NULL, so there is not necessity to processed with tests * coverity_20190924: Fix 338067 The current code tries to copy the same size of the variable, another possible solution would be to use a function to sanitize the code, I will try this first * coverity_20190924: Fix 348638 Considering that we are testing the variable value one line above The division will always happen * coverity_20190924: Fix 348640 For this specific case we do not have the possibility to have memory leak, valgrind confirms this, but I am adding a new variable here to the stack to discard the warning

thiagoftsm committed Oct 2, 2019 at 10:59 UTC f197e2d9901be1b462edd53b227e01f5d7a9483a
4 files changed +10 -7
collectors/apps.plugin/apps_plugin.c
+1 -1
@@ -3521,7 +3521,7 @@ static void send_collected_data_to_netdata(struct target *root, const char *type
3521 send_BEGIN(type, "uptime_avg", dt);
3522 for (w = root; w ; w = w->next) {
3523 if(unlikely(w->exposed && w->processes))
3524 - send_SET(w->name, w->processes?(w->uptime_sum / w->processes):0);
3524 + send_SET(w->name, w->uptime_sum / w->processes);
3525 }
3526 send_END();
3527
daemon/main.c
+1 -1
@@ -719,7 +719,7 @@ int get_system_info(struct rrdhost_system_info *system_info) {
719 }
720 char n[51], v[101];
721 snprintfz(n, 50,"%s",name);
722 - snprintfz(v, 101,"%s",value);
722 + snprintfz(v, 100,"%s",value);
723 if(unlikely(rrdhost_set_system_info_variable(system_info, n, v))) {
724 info("Unexpected environment variable %s=%s", n, v);
725 }
libnetdata/health/health.c
+2 -1
@@ -136,7 +136,8 @@ int health_silencers_json_read_callback(JSON_ENTRY *e)
136 else if (!strcmp(e->data.string,"DISABLE")) silencers->stype = STYPE_DISABLE_ALARMS;
137 } else {
138 debug(D_HEALTH, "JSON: Adding %s=%s", e->name, e->data.string);
139 - health_silencers_addparam(e->callback_data, e->name, e->data.string);
139 + SILENCER *test = health_silencers_addparam(e->callback_data, e->name, e->data.string);
140 + (void)test;
141 }
142 break;
143
libnetdata/json/jsmn.c
+6 -4
@@ -301,10 +301,12 @@ jsmnerr_t jsmn_parse(jsmn_parser *parser, const char *js, size_t len,
301 }
302 }
303
304 - for (i = parser->toknext - 1; i >= 0; i--) {
305 - /* Unmatched opened object or array */
306 - if (tokens[i].start != -1 && tokens[i].end == -1) {
307 - return JSMN_ERROR_PART;
304 + if (tokens) {
305 + for (i = parser->toknext - 1; i >= 0; i--) {
306 + /* Unmatched opened object or array */
307 + if (tokens[i].start != -1 && tokens[i].end == -1) {
308 + return JSMN_ERROR_PART;
309 + }
310 }
311 }
312