Skip to content

Commit

Permalink
lib-lda: Cleanup error handling in LMTP client code.
Browse files Browse the repository at this point in the history
If there are no successful recipients, we'll need to deinit the client.
But at that point we've already called all the callbacks, so the line
parameter to lmtp_client_fail_full() isn't actually used anywhere.
This was confusing static analyzer because global_fail_string was used
as parameter, which could have been NULL and wouldn't have been valid
for the callbacks.
  • Loading branch information
sirainen committed Sep 15, 2016
1 parent 41d9145 commit 6f94745
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib-lda/lmtp-client.c
Expand Up @@ -274,10 +274,14 @@ static int lmtp_client_send_data_cmd(struct lmtp_client *client)
if (client->rcpt_next_receive_idx < array_count(&client->recipients))
return 0;

if (client->global_fail_string != NULL || !client->rcpt_to_successes) {
if (client->global_fail_string != NULL) {
lmtp_client_fail_full(client, client->global_fail_string,
client->global_remote_failure);
return -1;
} else if (!client->rcpt_to_successes) {
/* This error string shouldn't become visible anywhere */
lmtp_client_fail_full(client, "No valid recipients", FALSE);
return -1;
} else {
client->input_state++;
o_stream_nsend_str(client->output, "DATA\r\n");
Expand Down

0 comments on commit 6f94745

Please sign in to comment.