]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: start relying on iostream_proxy_unref(NULL) being a no-op
authorJosef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
Thu, 9 Nov 2017 15:34:21 +0000 (10:34 -0500)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 12 Mar 2018 09:58:54 +0000 (11:58 +0200)
Cleanup performed with the following semantic patch:

@@
expression E;
@@

- if (E != NULL) {
-  iostream_proxy_unref(&E);
- }
+ iostream_proxy_unref(&E);

src/login-common/client-common.c
src/login-common/login-proxy.c

index ef917823ccdc9d5d0859faecd48d64d1ed83eb62..43e3610ffd29cdc659fa115f687b37a857daee66 100644 (file)
@@ -251,8 +251,7 @@ void client_disconnect(struct client *client, const char *reason)
                io_remove(&client->io);
                if (client->ssl_iostream != NULL)
                        ssl_iostream_destroy(&client->ssl_iostream);
-               if (client->iostream_fd_proxy != NULL)
-                       iostream_proxy_unref(&client->iostream_fd_proxy);
+               iostream_proxy_unref(&client->iostream_fd_proxy);
                i_stream_close(client->input);
                o_stream_close(client->output);
                i_close_fd(&client->fd);
@@ -365,8 +364,7 @@ bool client_unref(struct client **_client)
 
        if (client->ssl_iostream != NULL)
                ssl_iostream_destroy(&client->ssl_iostream);
-       if (client->iostream_fd_proxy != NULL)
-               iostream_proxy_unref(&client->iostream_fd_proxy);
+       iostream_proxy_unref(&client->iostream_fd_proxy);
        if (client->fd_proxying) {
                DLLIST_REMOVE(&client_fd_proxies, client);
                i_assert(client_fd_proxies_count > 0);
index e9cc0d1692f87c7af0c5e6575930ed5464c967e0..c32d387c8759f6305d091c705f0f5de4be1e283d 100644 (file)
@@ -386,8 +386,7 @@ static void login_proxy_disconnect(struct login_proxy *proxy)
                proxy->state_rec->num_proxying_connections--;
        }
 
-       if (proxy->iostream_proxy != NULL)
-               iostream_proxy_unref(&proxy->iostream_proxy);
+       iostream_proxy_unref(&proxy->iostream_proxy);
        if (proxy->server_ssl_iostream != NULL)
                ssl_iostream_destroy(&proxy->server_ssl_iostream);