Skip to content
Snippets Groups Projects

Fix zonedb reload related leaks

Merged David Vasek requested to merge catalog_zonedb_leak into master
Files
2
@@ -32,6 +32,9 @@
#include "knot/zone/zonefile.h"
#include "libknot/libknot.h"
#define FULL(conf) (!((conf)->io.flags & CONF_IO_FACTIVE) || \
((conf)->io.flags & CONF_IO_FRLD_ZONES))
static bool zone_file_updated(conf_t *conf, const zone_t *old_zone,
const knot_dname_t *zone_name)
{
@@ -294,6 +297,8 @@ static zone_t *reuse_member_zone(zone_t *zone, server_t *server, conf_t *conf,
return NULL;
}
bool full = FULL(conf);
catalog_upd_val_t *upd = catalog_update_get(&server->catalog_upd, zone->name);
if (upd != NULL) {
switch (upd->type) {
@@ -308,6 +313,9 @@ static zone_t *reuse_member_zone(zone_t *zone, server_t *server, conf_t *conf,
default:
break;
}
} else if (!full) {
printf("REUSE\n"); // TODO remove
return zone;
}
zone_t *newzone = create_zone(conf, zone->name, server, zone);
@@ -318,6 +326,7 @@ static zone_t *reuse_member_zone(zone_t *zone, server_t *server, conf_t *conf,
conf_activate_modules(conf, server, newzone->name, &newzone->query_modules,
&newzone->query_plan);
}
return newzone;
}
@@ -412,8 +421,7 @@ static knot_zonedb_t *create_zonedb(conf_t *conf, server_t *server, list_t *expi
return NULL;
}
bool full = !(conf->io.flags & CONF_IO_FACTIVE) ||
(conf->io.flags & CONF_IO_FRLD_ZONES);
bool full = FULL(conf);
/* Mark changed zones. */
if (!full) {
@@ -502,8 +510,7 @@ static void remove_old_zonedb(conf_t *conf, knot_zonedb_t *db_old,
knot_zonedb_t *db_new = server->zone_db;
bool full = !(conf->io.flags & CONF_IO_FACTIVE) ||
(conf->io.flags & CONF_IO_FRLD_ZONES);
bool full = FULL(conf);
if (db_old == NULL) {
goto catalog_only;
Loading