summaryrefslogtreecommitdiffstats
path: root/libssh/server.c
diff options
context:
space:
mode:
Diffstat (limited to 'libssh/server.c')
-rw-r--r--libssh/server.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/libssh/server.c b/libssh/server.c
index bb80ead..4cdf84b 100644
--- a/libssh/server.c
+++ b/libssh/server.c
@@ -170,10 +170,20 @@ SSH_SESSION *ssh_bind_accept(SSH_BIND *ssh_bind){
session=ssh_new();
session->server=1;
session->version=2;
+ session->options = ssh_options_copy(ssh_bind->options);
+ if (session->options == NULL) {
+ ssh_set_error(ssh_bind, SSH_FATAL, "No space left");
+ if (dsa)
+ private_key_free(dsa);
+ if (rsa)
+ private_key_free(rsa);
+ ssh_cleanup(session);
+ return NULL;
+ }
+
ssh_socket_free(session->socket);
session->socket=ssh_socket_new(session);
ssh_socket_set_fd(session->socket,fd);
- session->options=ssh_options_copy(ssh_bind->options);
session->dsa_key=dsa;
session->rsa_key=rsa;
return session;