diff --git a/daemon/remote.c b/daemon/remote.c index cc7082a20..74c5d4262 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -939,9 +939,9 @@ do_zone_remove(SSL* ssl, struct worker* worker, char* arg) nmlabs, LDNS_RR_CLASS_IN))) { /* present in tree */ local_zones_del_zone(worker->daemon->local_zones, z); - free(nm); } lock_quick_unlock(&worker->daemon->local_zones->lock); + free(nm); send_ok(ssl); } diff --git a/doc/Changelog b/doc/Changelog index bf2791dc4..099ee3e26 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,8 @@ +26 September 2008: Wouter + - tests for remote-control. + - small memory leak in exception during remote control fixed. + - fixup for lock checking but not unchecking in remote control. + 23 September 2008: Wouter - Msg cache is loaded. A cache load enables cache responses. - unbound-control flush [name], flush_type and flush_zone. diff --git a/services/localzone.c b/services/localzone.c index 289d3435e..a7452ea39 100644 --- a/services/localzone.c +++ b/services/localzone.c @@ -144,8 +144,8 @@ parse_dname(const char* str, uint8_t** res, size_t* len, int* labs) /** create a new localzone */ static struct local_zone* -local_zone_create(struct local_zones* zones, uint8_t* nm, size_t len, - int labs, enum localzone_type t, uint16_t dclass) +local_zone_create(uint8_t* nm, size_t len, int labs, + enum localzone_type t, uint16_t dclass) { struct local_zone* z = (struct local_zone*)calloc(1, sizeof(*z)); if(!z) { @@ -165,13 +165,7 @@ local_zone_create(struct local_zones* zones, uint8_t* nm, size_t len, } rbtree_init(&z->data, &local_data_cmp); lock_protect(&z->lock, &z->parent, sizeof(*z)-sizeof(rbnode_t)); - lock_protect(&zones->lock, &z->node, sizeof(z->node)); - lock_protect(&zones->lock, &z->parent, sizeof(z->parent)); - lock_protect(&zones->lock, &z->name, sizeof(z->name)); - lock_protect(&zones->lock, &z->namelen, sizeof(z->namelen)); - lock_protect(&zones->lock, &z->namelabs, sizeof(z->namelabs)); - lock_protect(&zones->lock, &z->dclass, sizeof(z->dclass)); - (void)zones; /* avoid argument unused warning if no lock checks */ + /* also the zones->lock protects node, parent, name*, class */ return z; } @@ -180,7 +174,7 @@ static struct local_zone* lz_enter_zone_dname(struct local_zones* zones, uint8_t* nm, size_t len, int labs, enum localzone_type t, uint16_t c) { - struct local_zone* z = local_zone_create(zones, nm, len, labs, t, c); + struct local_zone* z = local_zone_create(nm, len, labs, t, c); if(!z) { log_err("out of memory"); return NULL; @@ -1180,8 +1174,7 @@ struct local_zone* local_zones_add_zone(struct local_zones* zones, enum localzone_type tp) { /* create */ - struct local_zone* z = local_zone_create(zones, name, len, labs, tp, - dclass); + struct local_zone* z = local_zone_create(name, len, labs, tp, dclass); if(!z) return NULL; lock_rw_wrlock(&z->lock); diff --git a/smallapp/unbound-control.c b/smallapp/unbound-control.c index 050a6d5b5..9d39334cd 100644 --- a/smallapp/unbound-control.c +++ b/smallapp/unbound-control.c @@ -58,10 +58,10 @@ usage() printf(" -s ip[@port] server address, if omitted config is used.\n"); printf(" -h show this usage help.\n"); printf("Commands:\n"); - printf(" start start server; runs unbound(8)\n"); - printf(" stop stops the server\n"); - printf(" reload reloads the server\n"); - printf(" stats print statistics\n"); + printf(" start start server; runs unbound(8)\n"); + printf(" stop stops the server\n"); + printf(" reload reloads the server\n"); + printf(" stats print statistics\n"); printf(" verbosity [number] change logging detail\n"); printf(" local_zone [name] [type] add new local zone\n"); printf(" local_zone_remove [name] remove local zone and its contents\n"); @@ -302,6 +302,11 @@ int main(int argc, char* argv[]) int c, ret; char* cfgfile = CONFIGFILE; char* svr = NULL; +#ifdef USE_THREAD_DEBUG + /* stop the file output from unbound-control, overwites the servers */ + extern int check_locking_order; + check_locking_order = 0; +#endif /* USE_THREAD_DEBUG */ log_ident_set("unbound-control"); log_init(NULL, 0, NULL); checklock_start(); diff --git a/testdata/09-unbound-control.tpkg b/testdata/09-unbound-control.tpkg index b75f18cd4..92bf70528 100644 Binary files a/testdata/09-unbound-control.tpkg and b/testdata/09-unbound-control.tpkg differ