1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-30 13:01:23 +03:00

socket: Use calloc in ssh_socket_new()

This makes sure the content will be zero after successful allocation.

Resolves T134

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Anderson Toshiyuki Sasaki
2019-05-20 17:10:57 +02:00
committed by Andreas Schneider
parent 59ba3f1896
commit 9fb7fb3fac

View File

@@ -142,7 +142,7 @@ void ssh_socket_cleanup(void) {
ssh_socket ssh_socket_new(ssh_session session) { ssh_socket ssh_socket_new(ssh_session session) {
ssh_socket s; ssh_socket s;
s = malloc(sizeof(struct ssh_socket_struct)); s = calloc(1, sizeof(struct ssh_socket_struct));
if (s == NULL) { if (s == NULL) {
ssh_set_error_oom(session); ssh_set_error_oom(session);
return NULL; return NULL;