Skip to content

Commit 5d712ac

Browse files
committed
session client BUGFIX use-after-free
1 parent 2c9e4e2 commit 5d712ac

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/session_client_ssh.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1523,16 +1523,18 @@ _nc_connect_libssh(ssh_session ssh_session, struct ly_ctx *ctx, struct nc_keepal
15231523
free(host);
15241524
goto fail;
15251525
}
1526-
free(host);
15271526

15281527
/* create and connect socket */
15291528
sock = nc_sock_connect(host, port, -1, ka, NULL, &ip_host);
15301529
if (sock == -1) {
15311530
ERR(NULL, "Unable to connect to %s:%u (%s).", host, port, strerror(errno));
1531+
free(host);
15321532
goto fail;
15331533
}
15341534
ssh_options_set(session->ti.libssh.session, SSH_OPTIONS_FD, &sock);
15351535
ssh_set_blocking(session->ti.libssh.session, 0);
1536+
1537+
free(host);
15361538
host = ip_host;
15371539
}
15381540

0 commit comments

Comments
 (0)