Skip to content

Commit

Permalink
global: start relying on ssl_iostream_destroy(NULL) being a no-op
Browse files Browse the repository at this point in the history
Cleanup performed with the following semantic patch:

	@@
	expression E;
	@@

	- if (E != NULL) {
	- 	ssl_iostream_destroy(&E);
	- }
	+ ssl_iostream_destroy(&E);
  • Loading branch information
Josef 'Jeff' Sipek authored and cmouse committed Jan 31, 2018
1 parent 4836d54 commit ac581db
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/doveadm/client-connection-tcp.c
Expand Up @@ -623,8 +623,7 @@ client_connection_tcp_free(struct client_connection *_conn)
doveadm_server_restore_logs();
o_stream_unref(&conn->log_out);
}
if (conn->ssl_iostream != NULL)
ssl_iostream_destroy(&conn->ssl_iostream);
ssl_iostream_destroy(&conn->ssl_iostream);

io_remove(&conn->io);
o_stream_destroy(&conn->output);
Expand Down
3 changes: 1 addition & 2 deletions src/doveadm/doveadm-dsync.c
Expand Up @@ -717,8 +717,7 @@ cmd_dsync_run(struct doveadm_mail_cmd_context *_ctx, struct mail_user *user)
dsync_ibc_deinit(&ibc);
if (ibc2 != NULL)
dsync_ibc_deinit(&ibc2);
if (ctx->ssl_iostream != NULL)
ssl_iostream_destroy(&ctx->ssl_iostream);
ssl_iostream_destroy(&ctx->ssl_iostream);
if (ctx->ssl_ctx != NULL)
ssl_iostream_context_unref(&ctx->ssl_ctx);
if (ctx->input != NULL) {
Expand Down
3 changes: 1 addition & 2 deletions src/lib-smtp/smtp-server-connection.c
Expand Up @@ -1027,8 +1027,7 @@ smtp_server_connection_disconnect(struct smtp_server_connection *conn,
o_stream_uncork(conn->conn.output);
if (conn->smtp_parser != NULL)
smtp_command_parser_deinit(&conn->smtp_parser);
if (conn->ssl_iostream != NULL)
ssl_iostream_destroy(&conn->ssl_iostream);
ssl_iostream_destroy(&conn->ssl_iostream);

if (conn->callbacks != NULL &&
conn->callbacks->conn_disconnect != NULL) {
Expand Down
6 changes: 2 additions & 4 deletions src/login-common/client-common.c
Expand Up @@ -250,8 +250,7 @@ void client_disconnect(struct client *client, const char *reason)
o_stream_uncork(client->output);
if (!client->login_success) {
io_remove(&client->io);
if (client->ssl_iostream != NULL)
ssl_iostream_destroy(&client->ssl_iostream);
ssl_iostream_destroy(&client->ssl_iostream);
iostream_proxy_unref(&client->iostream_fd_proxy);
i_stream_close(client->input);
o_stream_close(client->output);
Expand Down Expand Up @@ -363,8 +362,7 @@ bool client_unref(struct client **_client)
if (client->v.free != NULL)
client->v.free(client);

if (client->ssl_iostream != NULL)
ssl_iostream_destroy(&client->ssl_iostream);
ssl_iostream_destroy(&client->ssl_iostream);
iostream_proxy_unref(&client->iostream_fd_proxy);
if (client->fd_proxying) {
DLLIST_REMOVE(&client_fd_proxies, client);
Expand Down
3 changes: 1 addition & 2 deletions src/login-common/login-proxy.c
Expand Up @@ -387,8 +387,7 @@ static void login_proxy_disconnect(struct login_proxy *proxy)
}

iostream_proxy_unref(&proxy->iostream_proxy);
if (proxy->server_ssl_iostream != NULL)
ssl_iostream_destroy(&proxy->server_ssl_iostream);
ssl_iostream_destroy(&proxy->server_ssl_iostream);

io_remove(&proxy->server_io);
i_stream_destroy(&proxy->server_input);
Expand Down

0 comments on commit ac581db

Please sign in to comment.