Skip to content
Snippets Groups Projects
Commit 7acffe5d authored by Marek Vavrusa's avatar Marek Vavrusa
Browse files

Fixed zone conf leaks. Capped slab memory usage.

parent 9c7d07de
No related branches found
No related tags found
No related merge requests found
......@@ -17,7 +17,7 @@
//#define MEM_DEBUG
//#define MEM_NOSLAB
//#define MEM_POISON
//#define MEM_SLAB_CAP 3 // Cap slab_cache empty slab count (undefined = inf)
#define MEM_SLAB_CAP 5 // Cap slab_cache empty slab count (undefined = inf)
#define MEM_COLORING // Slab cache coloring
//#define MEM_SLAB_DEPOT // Use slab depot for slab caching (not thread-safe)
......
......@@ -126,13 +126,14 @@ zone_start: TEXT {
nlen + 1,
0);
if (dn == 0) {
free(this_zone->name);
free(this_zone);
cf_error("invalid zone origin");
} else {
dnslib_dname_free(&dn);
add_tail(&new_config->zones, &this_zone->n);
++new_config->zones_count;
}
add_tail(&new_config->zones, &this_zone->n);
++new_config->zones_count;
}
;
......
......@@ -168,6 +168,7 @@ static void zone_free(conf_zone_t *zone)
free(zone->name);
free(zone->file);
free(zone->db);
free(zone);
}
/*!
......@@ -573,7 +574,7 @@ int conf_open(const char* path)
/* Parse config. */
int ret = conf_fparser(nconf);
if (ret != 0) {
if (ret != KNOT_EOK) {
conf_free(nconf);
return ret;
}
......@@ -583,8 +584,8 @@ int conf_open(const char* path)
/* Copy hooks. */
if (oldconf) {
node *n = 0;
WALK_LIST (n, oldconf->hooks) {
node *n = 0, *nxt = 0;
WALK_LIST_DELSAFE (n, nxt, oldconf->hooks) {
conf_hook_t *hook = (conf_hook_t*)n;
conf_add_hook(nconf, hook->sections,
hook->update, hook->data);
......
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