]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: connection: Remove useless test for NULL before calling `pool_free()`
authorTim Duesterhus <tim@bastelstu.be>
Sat, 6 Mar 2021 19:06:48 +0000 (20:06 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 9 Mar 2021 08:24:32 +0000 (09:24 +0100)
`pool_free()` is a noop when the given pointer is NULL. No need to test.

include/haproxy/connection.h

index e00e6f820ab83bd180a1c6db760a47c60458de9e..58b0d0e7b0c088a3e83d640804138da70bcba40d 100644 (file)
@@ -553,18 +553,14 @@ static inline void conn_free(struct connection *conn)
        sockaddr_free(&conn->src);
        sockaddr_free(&conn->dst);
 
-       if (conn->proxy_authority != NULL) {
-               pool_free(pool_head_authority, conn->proxy_authority);
-               conn->proxy_authority = NULL;
-       }
-       if (isttest(conn->proxy_unique_id)) {
-               pool_free(pool_head_uniqueid, conn->proxy_unique_id.ptr);
-               conn->proxy_unique_id = IST_NULL;
-       }
-       if (conn->hash_node) {
-               pool_free(pool_head_conn_hash_node, conn->hash_node);
-               conn->hash_node = NULL;
-       }
+       pool_free(pool_head_authority, conn->proxy_authority);
+       conn->proxy_authority = NULL;
+
+       pool_free(pool_head_uniqueid, conn->proxy_unique_id.ptr);
+       conn->proxy_unique_id = IST_NULL;
+
+       pool_free(pool_head_conn_hash_node, conn->hash_node);
+       conn->hash_node = NULL;
 
        /* By convention we always place a NULL where the ctx points to if the
         * mux is null. It may have been used to store the connection as a