@cryptotaxi247 / netdata-1 / commits / a0de93537

Remove warning from Coverity (#6992)

* health_nan: fix result The expression evaluate was keeping the value zero when there was a wrong variable, but according our documentation the correct result would be NAN, this commit fixes this * coverity_348642: remove unecessary check This commit removes an unecessary check for variable in the alarms * coverity_348642: remove fix I am removing a change from other commit here

thiagoftsm committed Oct 4, 2019 at 16:51 UTC a0de93537831b9e1b1f4425b4e29836e2fa6145a
1 file changed +11 -13
database/rrdcalc.c
+11 -13
@@ -584,21 +584,19 @@ void rrdcalc_unlink_and_free(RRDHOST *host, RRDCALC *rc) {
584 error("Cannot unlink alarm '%s.%s' from host '%s': not found", rc->chart?rc->chart:"NOCHART", rc->name, host->hostname);
585 }
586
587 - if (rc) {
588 - RRDCALC *rdcmp = (RRDCALC *) avl_search_lock(&(host)->alarms_idx_health_log, (avl *)rc);
589 - if (rdcmp) {
590 - rdcmp = (RRDCALC *) avl_remove_lock(&(host)->alarms_idx_health_log, (avl *)rc);
591 - if (!rdcmp) {
592 - error("Cannot remove the health alarm index from health_log");
593 - }
587 + RRDCALC *rdcmp = (RRDCALC *) avl_search_lock(&(host)->alarms_idx_health_log, (avl *)rc);
588 + if (rdcmp) {
589 + rdcmp = (RRDCALC *) avl_remove_lock(&(host)->alarms_idx_health_log, (avl *)rc);
590 + if (!rdcmp) {
591 + error("Cannot remove the health alarm index from health_log");
592 }
593 + }
594
596 - rdcmp = (RRDCALC *) avl_search_lock(&(host)->alarms_idx_name, (avl *)rc);
597 - if (rdcmp) {
598 - rdcmp = (RRDCALC *) avl_remove_lock(&(host)->alarms_idx_name, (avl *)rc);
599 - if (!rdcmp) {
600 - error("Cannot remove the health alarm index from idx_name");
601 - }
595 + rdcmp = (RRDCALC *) avl_search_lock(&(host)->alarms_idx_name, (avl *)rc);
596 + if (rdcmp) {
597 + rdcmp = (RRDCALC *) avl_remove_lock(&(host)->alarms_idx_name, (avl *)rc);
598 + if (!rdcmp) {
599 + error("Cannot remove the health alarm index from idx_name");
600 }
601 }
602