Skip to content

Commit

Permalink
use calloc
Browse files Browse the repository at this point in the history
  • Loading branch information
wangweij committed Feb 27, 2024
1 parent 38e4113 commit 9983d06
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/java.security.jgss/share/native/libj2gss/GSSLibStub.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,13 @@ gss_channel_bindings_t newGSSCB(JNIEnv *env, jobject jcb) {
if (jcb == NULL) {
return GSS_C_NO_CHANNEL_BINDINGS;
}
size_t size = sizeof(struct gss_channel_bindings_struct);
cb = malloc(size);

cb = calloc(1, sizeof(struct gss_channel_bindings_struct));
if (cb == NULL) {
gssThrowOutOfMemoryError(env, NULL);
return NULL;
}

memset(cb, 0, size);

// initialize addrtype in CB first
// LDAP TLS Channel Binding requires GSS_C_AF_UNSPEC address type
// for unspecified initiator and acceptor addresses.
Expand Down

0 comments on commit 9983d06

Please sign in to comment.