mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-12-05 01:02:39 +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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user