diff options
author | Tom Yu <tlyu@mit.edu> | 2005-09-22 02:48:09 +0000 |
---|---|---|
committer | Tom Yu <tlyu@mit.edu> | 2005-09-22 02:48:09 +0000 |
commit | 14fefb4f285d01a2b190f405a135a8e406e5e4fa (patch) | |
tree | 7b88a0133fe3cde6249b4b305997ed9c20f39b74 /src/lib/gssapi | |
parent | 8b43213ebe6ddd8d10f33a4bf4cc2f987c29ce7e (diff) | |
download | krb5-14fefb4f285d01a2b190f405a135a8e406e5e4fa.zip krb5-14fefb4f285d01a2b190f405a135a8e406e5e4fa.tar.gz krb5-14fefb4f285d01a2b190f405a135a8e406e5e4fa.tar.bz2 |
fix memory leaks in krb5_gss_import_name() and krb5_gss_inquire_cred()
* 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.
ticket: new
target_version: 1.4.3
tags: pullup
component: krb5-libs
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17386 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/gssapi')
-rw-r--r-- | src/lib/gssapi/krb5/ChangeLog | 7 | ||||
-rw-r--r-- | src/lib/gssapi/krb5/import_name.c | 1 | ||||
-rw-r--r-- | src/lib/gssapi/krb5/inq_cred.c | 7 |
3 files changed, 13 insertions, 2 deletions
diff --git a/src/lib/gssapi/krb5/ChangeLog b/src/lib/gssapi/krb5/ChangeLog index 17280db..98ed5fd 100644 --- a/src/lib/gssapi/krb5/ChangeLog +++ b/src/lib/gssapi/krb5/ChangeLog @@ -1,5 +1,12 @@ 2005-09-21 Tom Yu <tlyu@mit.edu> + * 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 828ba67..75cad9e 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 ec8578e..780e798 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; |