Add memory error checks for server functions.

git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@324 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
Andreas Schneider
2009-04-01 20:01:44 +00:00
parent 2c3e423480
commit b2e50e8967

View File

@@ -86,7 +86,10 @@ static socket_t bind_socket(SSH_BIND *ssh_bind,char *hostname, int port) {
}
SSH_BIND *ssh_bind_new(void){
SSH_BIND *ptr=malloc(sizeof(SSH_BIND));
SSH_BIND *ptr = malloc(sizeof(SSH_BIND));
if (ptr == NULL) {
return NULL;
}
memset(ptr,0,sizeof(*ptr));
ptr->bindfd=-1;
return ptr;
@@ -221,6 +224,9 @@ static int server_set_kex(SSH_SESSION * session) {
ssh_options_set_wanted_algos(options,SSH_HOSTKEYS,"ssh-rsa");
}
server->methods = malloc(10 * sizeof(char **));
if (server->methods == NULL) {
return -1;
}
for (i = 0; i < 10; i++) {
if (!(wanted = options->wanted_methods[i]))
wanted = supported_methods[i];