Use calloc instead of zeroizing structure after malloc

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Jakub Jelen
2025-08-01 11:55:50 +02:00
parent 737f9ecc3c
commit d1bf9068a9
5 changed files with 9 additions and 13 deletions

View File

@@ -1027,12 +1027,11 @@ int ssh_userauth_agent(ssh_session session, const char *username)
}
if (!session->agent_state) {
session->agent_state = malloc(sizeof(struct ssh_agent_state_struct));
session->agent_state = calloc(1, sizeof(struct ssh_agent_state_struct));
if (!session->agent_state) {
ssh_set_error_oom(session);
return SSH_AUTH_ERROR;
}
ZERO_STRUCTP(session->agent_state);
session->agent_state->state = SSH_AGENT_STATE_NONE;
}