Skip to content

Commit

Permalink
Protect metric release in dimension delete callback (netdata#17020)
Browse files Browse the repository at this point in the history
Protect metric release
  • Loading branch information
stelfrag authored Feb 16, 2024
1 parent 43eab7b commit dea9d1f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/database/rrddim.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,13 @@ static void rrddim_delete_callback(const DICTIONARY_ITEM *item __maybe_unused, v
}

for(size_t tier = 0; tier < storage_tiers ;tier++) {
if(!rd->tiers[tier].smh) continue;

STORAGE_ENGINE* eng = host->db[tier].eng;
eng->api.metric_release(rd->tiers[tier].smh);
rd->tiers[tier].smh = NULL;
spinlock_lock(&rd->tiers[tier].spinlock);
if(rd->tiers[tier].smh) {
STORAGE_ENGINE *eng = host->db[tier].eng;
eng->api.metric_release(rd->tiers[tier].smh);
rd->tiers[tier].smh = NULL;
}
spinlock_unlock(&rd->tiers[tier].spinlock);
}

if(rd->db.data) {
Expand Down

0 comments on commit dea9d1f

Please sign in to comment.