From: Marko Kreen Date: Wed, 31 Oct 2012 08:51:23 +0000 (+0200) Subject: dns: need to use statlist_remove() instead list_del() X-Git-Tag: pgbouncer_1_5_4~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bd87770845f10fea34eb792b6cbb29a914801ad3;p=pgbouncer dns: need to use statlist_remove() instead list_del() Otherwise host_list will have wrong count. It does not look like the codepath is actually ever used, but still... --- diff --git a/src/dnslookup.c b/src/dnslookup.c index fd5200d..b22b902 100644 --- a/src/dnslookup.c +++ b/src/dnslookup.c @@ -75,6 +75,7 @@ struct DNSRequest { struct List znode; /* DNSZone->host_list */ struct DNSContext *ctx; + struct DNSZone *zone; struct List ucb_list; /* DNSToken->node */ @@ -747,7 +748,8 @@ static void req_free(struct AANode *node, void *arg) freeaddrinfo(req->oldres); req->oldres = NULL; } - list_del(&req->znode); + if (req->zone) + statlist_remove(&req->zone->host_list, &req->znode); free(req->name); free(req); } @@ -974,6 +976,7 @@ static void zone_register(struct DNSContext *ctx, struct DNSRequest *req) if (n) { /* already exists */ z = container_of(n, struct DNSZone, tnode); + req->zone = z; statlist_append(&z->host_list, &req->znode); return; } @@ -994,6 +997,7 @@ static void zone_register(struct DNSContext *ctx, struct DNSRequest *req) aatree_insert(&ctx->zone_tree, (uintptr_t)z->zonename, &z->tnode); list_append(&ctx->zone_list, &z->lnode); statlist_append(&z->host_list, &req->znode); + req->zone = z; } static void zone_timer(int fd, short flg, void *arg)