From: Tom Yu Date: Thu, 22 Sep 2005 17:26:04 +0000 (+0000) Subject: pullup r17386 from trunk X-Git-Tag: krb5-1.4.3-beta1~20 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=04e8d4e8a7c01ee2ba78edc024444edfe1d03dc8;p=krb5.git pullup r17386 from trunk ticket: 3184 version_fixed: 1.4.3 git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-4@17392 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/gssapi/krb5/ChangeLog b/src/lib/gssapi/krb5/ChangeLog index 17280db6a..98ed5fded 100644 --- a/src/lib/gssapi/krb5/ChangeLog +++ b/src/lib/gssapi/krb5/ChangeLog @@ -1,5 +1,12 @@ 2005-09-21 Tom Yu + * import_name.c (krb5_gss_import_name): Add missing free of tmp in + an error case to fix a memory leak. + + * inq_cred.c (krb5_gss_inquire_cred): Memory leak fixes: call + krb5_gss_release_cred() with address of cred, not cred; add + missing call to krb5_gss_release_cred() in an error case. + * duplicate_name.c (krb5_gss_duplicate_name): * export_name.c (krb5_gss_export_name): Fix gsstest nit by clearing minor_status if no errors. diff --git a/src/lib/gssapi/krb5/import_name.c b/src/lib/gssapi/krb5/import_name.c index 828ba67da..75cad9e2f 100644 --- a/src/lib/gssapi/krb5/import_name.c +++ b/src/lib/gssapi/krb5/import_name.c @@ -187,6 +187,7 @@ krb5_gss_import_name(minor_status, input_name_buffer, stringrep = tmp2; } else { + xfree(tmp); krb5_free_context(context); return(GSS_S_BAD_NAMETYPE); } diff --git a/src/lib/gssapi/krb5/inq_cred.c b/src/lib/gssapi/krb5/inq_cred.c index ec8578e4e..780e79870 100644 --- a/src/lib/gssapi/krb5/inq_cred.c +++ b/src/lib/gssapi/krb5/inq_cred.c @@ -175,6 +175,9 @@ krb5_gss_inquire_cred(minor_status, cred_handle, name, lifetime_ret, if (name) { if (ret_name != NULL && ! kg_save_name((gss_name_t) ret_name)) { k5_mutex_unlock(&cred->lock); + if (cred_handle == GSS_C_NO_CREDENTIAL) + krb5_gss_release_cred(minor_status, (gss_cred_id_t)&cred); + (void) gss_release_oid_set(minor_status, &mechs); krb5_free_principal(context, ret_name); *minor_status = (OM_uint32) G_VALIDATE_FAILED; @@ -198,7 +201,7 @@ krb5_gss_inquire_cred(minor_status, cred_handle, name, lifetime_ret, *mechanisms = mechs; if (cred_handle == GSS_C_NO_CREDENTIAL) - krb5_gss_release_cred(minor_status, (gss_cred_id_t)cred); + krb5_gss_release_cred(minor_status, (gss_cred_id_t)&cred); krb5_free_context(context); *minor_status = 0; @@ -207,7 +210,7 @@ fail: if (cred_handle == GSS_C_NO_CREDENTIAL) { OM_uint32 tmp_min_stat; - krb5_gss_release_cred(&tmp_min_stat, (gss_cred_id_t)cred); + krb5_gss_release_cred(&tmp_min_stat, (gss_cred_id_t)&cred); } krb5_free_context(context); return ret;