diff options
author | Greg Hudson <ghudson@mit.edu> | 2011-07-25 15:54:39 +0000 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 2011-07-25 15:54:39 +0000 |
commit | e0273bc4d14db73824b0f1fcfcba5c26c2ae2e21 (patch) | |
tree | bfaa8716f53a3c7fb2eef2f26adfb9e5d5dd8769 /src | |
parent | 2b35c892b601dd414fee548e31d12a60dde4dabc (diff) | |
download | krb5-e0273bc4d14db73824b0f1fcfcba5c26c2ae2e21.tar.gz krb5-e0273bc4d14db73824b0f1fcfcba5c26c2ae2e21.tar.xz krb5-e0273bc4d14db73824b0f1fcfcba5c26c2ae2e21.zip |
Never return profile on error opening file
If profile_open_file() discovers a shared tree for the file, but
encounters an error when updating it, dereference the data and return
a null profile rather than returning an error and a newly broken file
object. Otherwise we'd leak the returned file object in
profile_init().
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25047 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r-- | src/util/profile/prof_file.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/util/profile/prof_file.c b/src/util/profile/prof_file.c index 988afacecf..b0bb087ebd 100644 --- a/src/util/profile/prof_file.c +++ b/src/util/profile/prof_file.c @@ -258,10 +258,15 @@ errcode_t profile_open_file(const_profile_filespec_t filespec, (void) k5_mutex_unlock(&g_shared_trees_mutex); retval = profile_update_file_data(data, NULL); free(expanded_filename); + if (retval) { + profile_dereference_data(data); + free(prf); + return retval; + } prf->data = data; *ret_prof = prf; scan_shared_trees_unlocked(); - return retval; + return 0; } (void) k5_mutex_unlock(&g_shared_trees_mutex); data = profile_make_prf_data(expanded_filename); |