From 20f5dd06be93df2d7ad3a1d76d8aac3a29ee8684 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Wed, 3 Apr 2013 09:25:37 -0400 Subject: Fix uninizialized variables found by Coverity Signed-off-by: Simo Sorce --- proxy/src/client/gpm_acquire_cred.c | 11 +++++------ proxy/src/mechglue/gpp_creds.c | 13 ++++++------- proxy/src/mechglue/gpp_init_sec_context.c | 3 ++- proxy/tests/cli_srv_comm.c | 2 +- proxy/tests/interposetest.c | 2 +- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/proxy/src/client/gpm_acquire_cred.c b/proxy/src/client/gpm_acquire_cred.c index 2b2c6c3..8f1cade 100644 --- a/proxy/src/client/gpm_acquire_cred.c +++ b/proxy/src/client/gpm_acquire_cred.c @@ -281,8 +281,8 @@ OM_uint32 gpm_inquire_cred(OM_uint32 *minor_status, gssx_name *dname = NULL; gssx_cred_element *e; gss_OID_desc tmp_oid; - uint32_t ret_min; - uint32_t ret_maj; + uint32_t ret_min = 0; + uint32_t ret_maj = GSS_S_COMPLETE; uint32_t life; int cu; int i; @@ -403,8 +403,8 @@ OM_uint32 gpm_inquire_cred_by_mech(OM_uint32 *minor_status, gssx_name *dname = NULL; gssx_cred_element *e; gss_OID_desc tmp_oid; - uint32_t ret_min; - uint32_t ret_maj; + uint32_t ret_min = 0; + uint32_t ret_maj = GSS_S_COMPLETE; int i; if (!cred) { @@ -465,8 +465,7 @@ OM_uint32 gpm_inquire_cred_by_mech(OM_uint32 *minor_status, } if (i >= cred->elements.elements_len) { - *minor_status = 0; - return GSS_S_FAILURE; + ret_maj = GSS_S_FAILURE; } done: diff --git a/proxy/src/mechglue/gpp_creds.c b/proxy/src/mechglue/gpp_creds.c index 7da2237..d9c18fe 100644 --- a/proxy/src/mechglue/gpp_creds.c +++ b/proxy/src/mechglue/gpp_creds.c @@ -63,18 +63,17 @@ OM_uint32 gppint_get_def_creds(OM_uint32 *minor_status, struct gpp_cred_handle **cred_handle) { struct gpp_cred_handle *cred; - OM_uint32 tmaj, tmin; - OM_uint32 maj, min; + OM_uint32 tmaj = GSS_S_COMPLETE; + OM_uint32 tmin = 0; + OM_uint32 maj = GSS_S_FAILURE; + OM_uint32 min = 0; cred = calloc(1, sizeof(struct gpp_cred_handle)); if (!cred) { - *minor_status = 0; - return GSS_S_FAILURE; + min = ENOMEM; + goto done; } - tmaj = GSS_S_COMPLETE; - tmin = 0; - /* See if we should try local first */ if (behavior == GPP_LOCAL_ONLY || behavior == GPP_LOCAL_FIRST) { diff --git a/proxy/src/mechglue/gpp_init_sec_context.c b/proxy/src/mechglue/gpp_init_sec_context.c index fc0489f..1b233a7 100644 --- a/proxy/src/mechglue/gpp_init_sec_context.c +++ b/proxy/src/mechglue/gpp_init_sec_context.c @@ -82,7 +82,7 @@ OM_uint32 gssi_init_sec_context(OM_uint32 *minor_status, OM_uint32 *ret_flags, OM_uint32 *time_rec) { - enum gpp_behavior behavior; + enum gpp_behavior behavior = GPP_UNINITIALIZED; struct gpp_context_handle *ctx_handle = NULL; struct gpp_cred_handle *cred_handle = NULL; struct gpp_name_handle *name; @@ -100,6 +100,7 @@ OM_uint32 gssi_init_sec_context(OM_uint32 *minor_status, if (mech_type == GSS_C_NO_OID || gpp_is_special_oid(mech_type)) { maj = GSS_S_BAD_MECH; + min = 0; goto done; } diff --git a/proxy/tests/cli_srv_comm.c b/proxy/tests/cli_srv_comm.c index 1e055ca..f085af3 100644 --- a/proxy/tests/cli_srv_comm.c +++ b/proxy/tests/cli_srv_comm.c @@ -363,7 +363,7 @@ void *server_thread(void *pvt) uint32_t ret_min; struct gssx_ctx *context_handle = NULL; struct gssx_cred *cred_handle = NULL; - struct gssx_name *src_name; + struct gssx_name *src_name = NULL; gss_buffer_desc out_token = GSS_C_EMPTY_BUFFER; struct gssx_cred *deleg_cred = NULL; gss_OID_set mech_set = GSS_C_NO_OID_SET; diff --git a/proxy/tests/interposetest.c b/proxy/tests/interposetest.c index 83e550d..ed286d6 100644 --- a/proxy/tests/interposetest.c +++ b/proxy/tests/interposetest.c @@ -228,7 +228,7 @@ void run_client(struct aproc *data) gss_buffer_desc msg_buf = GSS_C_EMPTY_BUFFER; char *message = "SECRET"; int ret = -1; - gss_iov_buffer_desc iov[2]; + gss_iov_buffer_desc iov[2] = { { 0, { 0, NULL } }, { 0, { 0, NULL } } }; int sealed; uint32_t max_size = 0; -- cgit