Skip to content

Commit

Permalink
prevent memory corruption in dbengine (netdata#19365)
Browse files Browse the repository at this point in the history
prevent memory corruption
  • Loading branch information
ktsaou authored Jan 10, 2025
1 parent d447f55 commit a553390
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/database/engine/rrdengineapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -911,8 +911,10 @@ void rrdeng_load_metric_finalize(struct storage_engine_query_handle *seqh)
pgdc_reset(&handle->pgdc, NULL, UINT32_MAX);
}

if(!pdc_release_and_destroy_if_unreferenced(handle->pdc, false, false))
if(handle->pdc) {
__atomic_store_n(&handle->pdc->workers_should_stop, true, __ATOMIC_RELAXED);
pdc_release_and_destroy_if_unreferenced(handle->pdc, false, false);
}

unregister_query_handle(handle);
rrdeng_query_handle_release(handle);
Expand Down

0 comments on commit a553390

Please sign in to comment.