Fix heap-use-after-free due to the chart using netdata_config memory for some strings. (#10498)
Markos Fountoulakis committed
Jan 13, 2021 at 17:34 UTC
8ce96cdefc7fb443a87f8bc03548afd1fe1df7f4
1 file changed
+5
-5
database/rrdset.c
+5
-5
@@ -330,11 +330,6 @@ void rrdset_free(RRDSET *st) {
330
331
rrdset_index_del_name(host, st);
332
333
- // ------------------------------------------------------------------------
334
- // remove it from the configuration
335
-
336
- appconfig_section_destroy_non_loaded(&netdata_config, st->config_section);
337
-
333
// ------------------------------------------------------------------------
334
// free its children structures
335
@@ -353,6 +348,11 @@ void rrdset_free(RRDSET *st) {
348
debug(D_RRD_CALLS, "RRDSET: Cleaning up remaining chart variables for host '%s', chart '%s'", host->hostname, st->id);
349
rrdvar_free_remaining_variables(host, &st->rrdvar_root_index);
350
351
+ // ------------------------------------------------------------------------
352
+ // remove it from the configuration
353
+
354
+ appconfig_section_destroy_non_loaded(&netdata_config, st->config_section);
355
+
356
// ------------------------------------------------------------------------
357
// unlink it from the host
358