]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
clean up pointers on clone
authorAlan T. DeKok <aland@freeradius.org>
Thu, 25 Jan 2018 19:31:15 +0000 (14:31 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 25 Jan 2018 19:31:59 +0000 (14:31 -0500)
and only free in the master

src/modules/proto_radius/proto_radius_udp.c

index 641123f7f90597023420f22ce2d9549c249a76a0..7d901f2161e10486e0690a4e6b155276d5a0e430 100644 (file)
@@ -740,6 +740,10 @@ static proto_radius_udp_t *mod_clone(proto_radius_udp_t *inst, proto_radius_udp_
        child->child.src_ipaddr = address->src_ipaddr;
        child->child.src_port = address->src_port;
 
+       child->dynamic_clients.clients = NULL;
+       child->dynamic_clients.expired = NULL;
+       child->dynamic_clients.trie = NULL;
+
        child->child.client = client_clone(child, address->client);
        if (!child->child.client) {
                ERROR("Failed cloning client");
@@ -2073,8 +2077,6 @@ static int mod_detach(void *instance)
 
        close(inst->sockfd);
 
-       if (inst->dynamic_clients.clients) TALLOC_FREE(inst->dynamic_clients.clients);
-
        /*
         *      Clean up extra tracking information when using
         *      connected sockets.
@@ -2105,6 +2107,12 @@ static int mod_detach(void *instance)
                }
        }
 
+       if (inst->dynamic_clients_is_set) {
+               TALLOC_FREE(inst->dynamic_clients.clients);
+               TALLOC_FREE(inst->dynamic_clients.expired);
+               TALLOC_FREE(inst->dynamic_clients.trie);
+       }
+
        return 0;
 }