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

gssapi: Rewrite allocation check to avoid zero_structpt

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Norbert Pocs <npocs@redhat.com>
This commit is contained in:
Jakub Jelen
2023-06-27 14:55:23 +02:00
parent 6e016c1c54
commit cba1dfac6c

View File

@@ -72,12 +72,11 @@ static int ssh_gssapi_init(ssh_session session)
{
if (session->gssapi != NULL)
return SSH_OK;
session->gssapi = malloc(sizeof(struct ssh_gssapi_struct));
if(!session->gssapi){
session->gssapi = calloc(1, sizeof(struct ssh_gssapi_struct));
if (session->gssapi == NULL) {
ssh_set_error_oom(session);
return SSH_ERROR;
}
ZERO_STRUCTP(session->gssapi);
session->gssapi->server_creds = GSS_C_NO_CREDENTIAL;
session->gssapi->client_creds = GSS_C_NO_CREDENTIAL;
session->gssapi->ctx = GSS_C_NO_CONTEXT;