Skip to content
Snippets Groups Projects
Commit a762c118 authored by Jan Kadlec's avatar Jan Kadlec
Browse files

Freeing of NSID options. Freeing of NSID in conf.

parent 4a49c2c0
No related branches found
No related tags found
No related merge requests found
......@@ -575,6 +575,10 @@ void conf_truncate(conf_t *conf, int unload_hooks)
free(conf->pidfile);
conf->pidfile = 0;
}
if (conf->nsid) {
free(conf->nsid);
conf->nsid = 0;
}
}
void conf_free(conf_t *conf)
......
......@@ -42,6 +42,7 @@ knot_opt_rr_t *knot_edns_new()
knot_opt_rr_t *opt_rr = (knot_opt_rr_t *)malloc(
sizeof(knot_opt_rr_t));
CHECK_ALLOC_LOG(opt_rr, NULL);
memset(opt_rr, 0, sizeof(knot_opt_rr_t));
opt_rr->size = KNOT_EDNS_MIN_SIZE;
opt_rr->option_count = 0;
opt_rr->options_max = 0;
......@@ -417,6 +418,13 @@ void knot_edns_free(knot_opt_rr_t **opt_rr)
}
if ((*opt_rr)->option_count > 0) {
/* Free the option data, if any. */
for (int i = 0; i < (*opt_rr)->option_count; i++) {
struct knot_opt_option option = (*opt_rr)->options[i];
if (option.data != NULL) {
free(option.data);
}
}
free((*opt_rr)->options);
}
free(*opt_rr);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment