]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: resolvers: Remove server from named_servers tree when removing a SRV item
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 15 Jun 2021 14:14:37 +0000 (16:14 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 17 Jun 2021 14:52:35 +0000 (16:52 +0200)
When a server is cleaned up because the corresponding SRV item is removed,
we always remove the server from the srvrq's name_servers tree. For now, it
is useless because, if a server was attached to a SRV item, it means it was
already removed from the tree. But it will be mandatory to fix a bug.

src/resolvers.c

index 69016111b9cb9e054ed511b17b254c14103477b4..8e18faa7224b6637fe4fb7b3bbe963264b78454d 100644 (file)
@@ -588,6 +588,10 @@ static void resolv_srvrq_cleanup_srv(struct server *srv)
        memset(&srv->addr, 0, sizeof(srv->addr));
        srv->svc_port = 0;
        srv->flags |= SRV_F_NO_RESOLUTION;
+
+       ebpt_delete(&srv->host_dn);
+       ha_free(&srv->host_dn.key);
+
        HA_SPIN_UNLOCK(SERVER_LOCK, &srv->lock);
        LIST_DELETE(&srv->srv_rec_item);
        LIST_APPEND(&srv->srvrq->attached_servers, &srv->srv_rec_item);
@@ -685,7 +689,7 @@ static void resolv_check_response(struct resolv_resolution *res)
                                                if (srv->svc_port == item->port) {
                                                        /* server found, we remove it from tree */
                                                        ebpt_delete(node);
-                                                       free(srv->host_dn.key);
+                                                       ha_free(&srv->host_dn.key);
                                                        goto srv_found;
                                                }