diff options
author | Richard Basch <probe@mit.edu> | 1997-02-18 17:31:44 +0000 |
---|---|---|
committer | Richard Basch <probe@mit.edu> | 1997-02-18 17:31:44 +0000 |
commit | 36bec5ea384f69bbc5a116e12a4dfaa3e9728295 (patch) | |
tree | 6c7905aacc31f4f8414137e64d495a61fedad91a /src/util | |
parent | 104211070284f5c73d35dbf0c7e6154f921155f4 (diff) | |
download | krb5-36bec5ea384f69bbc5a116e12a4dfaa3e9728295.tar.gz krb5-36bec5ea384f69bbc5a116e12a4dfaa3e9728295.tar.xz krb5-36bec5ea384f69bbc5a116e12a4dfaa3e9728295.zip |
Do not free unallocated memory (win16)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9901 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/et/error_message.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/util/et/error_message.c b/src/util/et/error_message.c index cf55af0c45..78bca4208d 100644 --- a/src/util/et/error_message.c +++ b/src/util/et/error_message.c @@ -162,15 +162,23 @@ oops: return(buffer); } + +#ifdef _MSDOS +/* + * Win16 applications cannot call malloc while the DLL is being + * initialized... To get around this, we pre-allocate an array + * sufficient to hold several error tables. + */ +#define PREALLOCATE_ETL 32 +static struct et_list etl[PREALLOCATE_ETL]; +static int etl_used = 0; +#endif + KRB5_DLLIMP errcode_t KRB5_CALLCONV add_error_table(et) const struct error_table FAR * et; { struct et_list *el = _et_list; -#ifdef _MSDOS - static struct et_list etl[32]; - static int etl_used = 0; -#endif while (el) { if (el->table->base == et->base) @@ -179,12 +187,7 @@ add_error_table(et) } #ifdef _MSDOS - /* - * Win16 applications cannot call malloc while the DLL is being - * initialized... To get around this, we pre-allocate an array - * sufficient to hold several error tables. - */ - if (etl_used < sizeof(etl)/sizeof(struct et_list)) + if (etl_used < PREALLOCATE_ETL) el = &etl[etl_used++]; else #endif @@ -211,7 +214,10 @@ remove_error_table(et) el2->next = el->next; else _et_list = el->next; - (void) free(el); +#ifdef _MSDOS + if ((el < etl) || (el > &etl[PREALLOCATE_ETL-1])) +#endif + (void) free(el); return 0; } el2 = el; |