diff options
| author | Ezra Peisach <epeisach@mit.edu> | 2006-06-01 03:18:19 +0000 |
|---|---|---|
| committer | Ezra Peisach <epeisach@mit.edu> | 2006-06-01 03:18:19 +0000 |
| commit | c5ac1117b5509a136aae235adc31828ac092d29f (patch) | |
| tree | 53dd5bf8a1fd3735cb1addea551c3d2954a0cfb9 /src/lib | |
| parent | 2e376ed28688004f733853cdca98e848a77d1d39 (diff) | |
krb5 1.5 alpha - memory leaks in krb5kdc due to not freeing error messages
In the kdc and lib/kadm5/logger.c, krb5_get_error_message needs to be paired
with krb5_free_error_message to release returned memory.
Essentially a memory leak was introduced for every principal requested
that did not exist in the database.
Identified by valgrind on the kdc - running kdc_hammer and specifying
more principals than are present in the db.
ticket: new
tags: pullup
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18072 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/kadm5/logger.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/kadm5/logger.c b/src/lib/kadm5/logger.c index f78c7b48e..24d845162 100644 --- a/src/lib/kadm5/logger.c +++ b/src/lib/kadm5/logger.c @@ -194,10 +194,13 @@ klog_com_err_proc(const char *whoami, long int code, const char *format, va_list /* If reporting an error message, separate it. */ if (code) { + char *emsg; outbuf[sizeof(outbuf) - 1] = '\0'; - strncat(outbuf, krb5_get_error_message (err_context, code), sizeof(outbuf) - 1 - strlen(outbuf)); + emsg = krb5_get_error_message (err_context, code); + strncat(outbuf, emsg, sizeof(outbuf) - 1 - strlen(outbuf)); strncat(outbuf, " - ", sizeof(outbuf) - 1 - strlen(outbuf)); + krb5_free_error_message(err_context, emsg); } cp = &outbuf[strlen(outbuf)]; |
