Skip to content

Commit

Permalink
get_shadow_line: Don't leak socket
Browse files Browse the repository at this point in the history
  • Loading branch information
donald committed May 18, 2021
1 parent 21249d8 commit 56205e5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion get_shadow_line.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ static int get_shadow_line(char *user, char **line) {
SSL_CTX_set_verify(ssl_ctx, SSL_VERIFY_PEER, NULL);
if (SSL_CTX_load_verify_locations(ssl_ctx, "/etc/mxshadow.cert.pem", NULL) == 0) { psslerror("SSL_CTX_load_verify_locations"); return -1; }

int sock = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0);
int sock _cleanup_(free_fd) = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0);
if (sock == -1) { COMMON_LOG(LOG_ERR, "socket: %m"); return -1; }

status = connect_with_timeout(sock, (struct sockaddr *)&sockaddr, sizeof(sockaddr), TIMEOUT);
Expand Down

0 comments on commit 56205e5

Please sign in to comment.