]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: resolvers: Use ha_free() in srvrq_resolution_error_cb()
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 10 Mar 2021 14:51:13 +0000 (15:51 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 12 Mar 2021 16:42:47 +0000 (17:42 +0100)
Two occurrences to "free(A);A=NULL;" may be replaced by a call to ha_free()
in the srvrq_resolution_error_cb() function.

src/server.c

index 809666fae1c1066c913a16f2d887915c3412e4c7..ee5bbac380dfe5c7c5e48db6f52fd2291e1c1b32 100644 (file)
@@ -3296,12 +3296,10 @@ int srvrq_resolution_error_cb(struct resolv_requester *requester, int error_code
                if (s->srvrq == srvrq) {
                        resolv_unlink_resolution(s->resolv_requester, 1);
                        srvrq_update_srv_status(s, 1);
-                       free(s->hostname);
-                       free(s->hostname_dn);
-                       s->hostname        = NULL;
-                       s->hostname_dn     = NULL;
-                       s->hostname_dn_len = 0;
                        memset(&s->addr, 0, sizeof(s->addr));
+                       ha_free(&s->hostname);
+                       ha_free(&s->hostname_dn);
+                       s->hostname_dn_len = 0;
                        s->svc_port = 0;
                }
                HA_SPIN_UNLOCK(SERVER_LOCK, &s->lock);