diff options
author | Ezra Peisach <epeisach@mit.edu> | 2008-08-14 16:40:07 +0000 |
---|---|---|
committer | Ezra Peisach <epeisach@mit.edu> | 2008-08-14 16:40:07 +0000 |
commit | 3ceb437bee2c48950e5b4131164276870b40f8e7 (patch) | |
tree | e2695cd4e52bf187a7b9061c47f94c4bc4b2fd00 /src/lib | |
parent | ad499ad382a7fc21cec0a19236cd602b4bee7366 (diff) | |
download | krb5-3ceb437bee2c48950e5b4131164276870b40f8e7.tar.gz krb5-3ceb437bee2c48950e5b4131164276870b40f8e7.tar.xz krb5-3ceb437bee2c48950e5b4131164276870b40f8e7.zip |
In parsing principal - if run out memory - clean up after ourselves.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20658 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/krb5/ccache/cc_file.c | 11 | ||||
-rw-r--r-- | src/lib/krb5/ccache/cc_keyring.c | 1 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/lib/krb5/ccache/cc_file.c b/src/lib/krb5/ccache/cc_file.c index f69d4929c..0e5a9b666 100644 --- a/src/lib/krb5/ccache/cc_file.c +++ b/src/lib/krb5/ccache/cc_file.c @@ -503,6 +503,7 @@ krb5_fcc_read_principal(krb5_context context, krb5_ccache id, krb5_principal *pr errout: while(--i >= 0) free(krb5_princ_component(context, tmpprinc, i)->data); + krb5_xfree(krb5_princ_realm(context, tmpprinc)->data); free((char *)tmpprinc->data); free((char *)tmpprinc); return kret; @@ -1807,9 +1808,15 @@ krb5_fcc_start_seq_get(krb5_context context, krb5_ccache id, /* Make sure we start reading right after the primary principal */ kret = krb5_fcc_skip_header(context, id); - if (kret) goto done; + if (kret) { + krb5_xfree(fcursor); + goto done; + } kret = krb5_fcc_skip_principal(context, id); - if (kret) goto done; + if (kret) { + krb5_xfree(fcursor); + goto done; + } fcursor->pos = fcc_lseek(data, (off_t) 0, SEEK_CUR); *cursor = (krb5_cc_cursor) fcursor; diff --git a/src/lib/krb5/ccache/cc_keyring.c b/src/lib/krb5/ccache/cc_keyring.c index 163ad30f7..d892584fe 100644 --- a/src/lib/krb5/ccache/cc_keyring.c +++ b/src/lib/krb5/ccache/cc_keyring.c @@ -1360,6 +1360,7 @@ krb5_krcc_parse_principal(krb5_context context, krb5_ccache id, errout: while (--i >= 0) free(krb5_princ_component(context, tmpprinc, i)->data); + krb5_xfree(krb5_princ_realm(context, tmpprinc)->data); free((char *) tmpprinc->data); free((char *) tmpprinc); return kret; |