]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: checks: exclusively use cs_destroy() to release a connection
authorWilly Tarreau <w@1wt.eu>
Sun, 8 Oct 2017 09:10:19 +0000 (11:10 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 Oct 2017 17:03:24 +0000 (18:03 +0100)
This way we're using the more consistent API everywhere.

src/checks.c

index 49d9467032d9e39bd3b542f6022eef34a6215db2..0b72bb21d72950df6e1796db3d86bd6cc51590ed 100644 (file)
@@ -2210,7 +2210,7 @@ static struct task *process_chk_conn(struct task *t)
                        cs_close(cs);
                }
 
-               if (conn) {
+               if (cs) {
                        cs_destroy(cs);
                        cs = check->cs = NULL;
                        conn = NULL;
@@ -2706,11 +2706,8 @@ static int tcpcheck_main(struct check *check)
                                return retcode;
                        }
 
-                       if (check->cs) {
-                               if (check->cs->conn)
-                                       conn_free(check->cs->conn);
-                               cs_free(check->cs);
-                       }
+                       if (check->cs)
+                               cs_destroy(check->cs);
 
                        check->cs = cs;
                        conn = cs->conn;