@cryptotaxi247 / netdata-1 / commits / 77e5795e8

Fix access of memory after free (#16185)

* Proper init to avoid use after free * CID 400083 Unchecked return value

Stelios Fragkakis committed Oct 13, 2023 at 21:16 UTC 77e5795e8d09ee6c9798f144ae36242e901ae3b7
2 files changed +2 -1
database/rrdcalc.c
+1
@@ -135,6 +135,7 @@ static STRING *rrdcalc_replace_variables_with_rrdset_labels(const char *line, RR
135 label_val[i - RRDCALC_VAR_LABEL_LEN - 1] = '\0';
136
137 if(likely(rc->rrdset && rc->rrdset->rrdlabels)) {
138 + lbl_value = NULL;
139 rrdlabels_get_value_strdup_or_null(rc->rrdset->rrdlabels, &lbl_value, label_val);
140 if (lbl_value) {
141 char *buf = find_and_replace(temp, var, lbl_value, m);
database/sqlite/sqlite_functions.c
+1 -1
@@ -414,7 +414,7 @@ int sql_init_database(db_check_action_type_t rebuild, int memory)
414 sqlite3_free(err_msg);
415 }
416 else {
417 - db_execute(db_meta, "select count(*) from sqlite_master limit 0");
417 + (void) db_execute(db_meta, "select count(*) from sqlite_master limit 0");
418 (void) sqlite3_close(db_meta);
419 }
420 return 1;