summaryrefslogtreecommitdiffstats
path: root/database/rrdcalc.c
diff options
context:
space:
mode:
authorthiagoftsm <thiagoftsm@gmail.com>2019-07-05 10:45:17 +0000
committerChris Akritidis <43294513+cakrit@users.noreply.github.com>2019-07-05 12:45:17 +0200
commit80b70d37f26c9d310f71d7ab32bf4c8a228200f7 (patch)
tree5a5f9cf474a31b0cca1f8bf760c5c737ac33c188 /database/rrdcalc.c
parentffa23129c03ba1e162cb22a00c64439f68390470 (diff)
Health_index (#6377)
Inside rrdcalc_unlink_and_free I wrote a not proper way to check the presence of an element inside the AVL, so I was raising an error without to do the correct checks!
Diffstat (limited to 'database/rrdcalc.c')
-rw-r--r--database/rrdcalc.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/database/rrdcalc.c b/database/rrdcalc.c
index 835eeab336..908fc2ebfd 100644
--- a/database/rrdcalc.c
+++ b/database/rrdcalc.c
@@ -438,14 +438,20 @@ void rrdcalc_unlink_and_free(RRDHOST *host, RRDCALC *rc) {
}
if (rc) {
- RRDCALC *rdcmp = (RRDCALC *) avl_remove_lock(&(host)->alarms_idx_health_log, (avl *)rc);
- if (!rdcmp) {
- error("Cannot remove the health alarm index");
+ RRDCALC *rdcmp = (RRDCALC *) avl_search_lock(&(host)->alarms_idx_health_log, (avl *)rc);
+ if (rdcmp) {
+ rdcmp = (RRDCALC *) avl_remove_lock(&(host)->alarms_idx_health_log, (avl *)rc);
+ if (!rdcmp) {
+ error("Cannot remove the health alarm index from health_log");
+ }
}
- rdcmp = (RRDCALC *) avl_remove_lock(&(host)->alarms_idx_name, (avl *)rc);
- if (!rdcmp) {
- error("Cannot remove the health alarm index");
+ rdcmp = (RRDCALC *) avl_search_lock(&(host)->alarms_idx_name, (avl *)rc);
+ if (rdcmp) {
+ rdcmp = (RRDCALC *) avl_remove_lock(&(host)->alarms_idx_name, (avl *)rc);
+ if (!rdcmp) {
+ error("Cannot remove the health alarm index from idx_name");
+ }
}
}