mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 02:38:09 +09:00
bind: Use calloc instead of malloc
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
0bde6b142c
commit
19e886d6b1
@@ -132,11 +132,10 @@ static socket_t bind_socket(ssh_bind sshbind, const char *hostname,
|
|||||||
ssh_bind ssh_bind_new(void) {
|
ssh_bind ssh_bind_new(void) {
|
||||||
ssh_bind ptr;
|
ssh_bind ptr;
|
||||||
|
|
||||||
ptr = malloc(sizeof(struct ssh_bind_struct));
|
ptr = calloc(1, sizeof(struct ssh_bind_struct));
|
||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
ZERO_STRUCTP(ptr);
|
|
||||||
ptr->bindfd = SSH_INVALID_SOCKET;
|
ptr->bindfd = SSH_INVALID_SOCKET;
|
||||||
ptr->bindport= 22;
|
ptr->bindport= 22;
|
||||||
ptr->common.log_verbosity = 0;
|
ptr->common.log_verbosity = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user