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:
committed by
Andreas Schneider
parent
59ba3f1896
commit
9fb7fb3fac
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user