diff options
author | Emmanuel Vasilakis <mrzammler@mm.st> | 2022-03-30 13:39:38 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-30 13:39:38 +0300 |
commit | dcf9679b109e8a334741dadf12ec26c3306f2015 (patch) | |
tree | 92bac05b6a1679e398cd459a0a99c5ef2b883fa3 /database | |
parent | 41a40dc3a406c3c8dc70f41038e7d75ef2601f8b (diff) |
Don't send alert events without wc->host (#12547)
* if wc->host is null dont send events
* we will always have wc->host
* free claim_id
Diffstat (limited to 'database')
-rw-r--r-- | database/sqlite/sqlite_aclk_alert.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/database/sqlite/sqlite_aclk_alert.c b/database/sqlite/sqlite_aclk_alert.c index 0e1e849f4b..0d78caa46a 100644 --- a/database/sqlite/sqlite_aclk_alert.c +++ b/database/sqlite/sqlite_aclk_alert.c @@ -135,6 +135,11 @@ void aclk_push_alert_event(struct aclk_database_worker_config *wc, struct aclk_d if (unlikely(!claim_id)) return; + if (unlikely(!wc->host)) { + freez(claim_id); + return; + } + BUFFER *sql = buffer_create(1024); if (wc->alerts_start_seq_id != 0) { @@ -269,7 +274,7 @@ void aclk_push_alert_event(struct aclk_database_worker_config *wc, struct aclk_d db_execute(buffer_tostring(sql)); } else { if (log_first_sequence_id) - log_access("OG [%s (%s)]: Sent alert events, first sequence_id %"PRIu64", last sequence_id %"PRIu64, wc->node_id, wc->host ? wc->host->hostname : "N/A", log_first_sequence_id, log_last_sequence_id); + log_access("OG [%s (%s)]: Sent alert events, first sequence_id %"PRIu64", last sequence_id %"PRIu64, wc->node_id, wc->host->hostname, log_first_sequence_id, log_last_sequence_id); log_first_sequence_id = 0; log_last_sequence_id = 0; } |