diff options
author | Eduardo Chappa <chappa@washington.edu> | 2018-05-18 17:12:19 -0600 |
---|---|---|
committer | Eduardo Chappa <chappa@washington.edu> | 2018-05-18 17:12:19 -0600 |
commit | 58396d907b993f849a7f32b9665b793c9a5c5d0e (patch) | |
tree | ff6c9b6b1e075c9f05938a4292a4a7a6a31aa2f5 /pith | |
parent | ae4bbcf4e8bb991ad3106ff0d7799276912c5815 (diff) | |
download | alpine-58396d907b993f849a7f32b9665b793c9a5c5d0e.tar.xz |
* Release memory of a conversion table to UTF-8, if this was created by
us.
* Some distributions of OpenSSL do not define ERR_free_strings and
EVP_cleanup, so we only execute them when defined. Reported by Erich
Eckner.
Diffstat (limited to 'pith')
-rw-r--r-- | pith/filter.c | 11 | ||||
-rw-r--r-- | pith/filter.h | 2 | ||||
-rw-r--r-- | pith/send.c | 2 | ||||
-rw-r--r-- | pith/smime.c | 4 |
4 files changed, 14 insertions, 5 deletions
diff --git a/pith/filter.c b/pith/filter.c index ea98a4ea..e4dbda07 100644 --- a/pith/filter.c +++ b/pith/filter.c @@ -1799,6 +1799,7 @@ gf_convert_8bit_charset(FILTER_S *f, int flg) typedef struct _utf8c_s { void *conv_table; int report_err; + int free_this; } UTF8C_S; @@ -1913,9 +1914,12 @@ gf_convert_utf8_charset(FILTER_S *f, int flg) } else if(flg == GF_EOD){ (void) GF_FLUSH(f->next); - if(f->opt) + if(f->opt){ + if(((UTF8C_S *) f->opt)->conv_table != NULL + && ((UTF8C_S *) f->opt)->free_this != 0) + fs_give((void **) &((UTF8C_S *) f->opt)->conv_table); fs_give((void **) &f->opt); - + } (*f->next->f)(f->next, GF_EOD); } else if(flg == GF_RESET){ @@ -1929,13 +1933,14 @@ gf_convert_utf8_charset(FILTER_S *f, int flg) void * -gf_convert_utf8_charset_opt(void *table, int report_err) +gf_convert_utf8_charset_opt(void *table, int report_err, int free_this) { UTF8C_S *utf8c; utf8c = (UTF8C_S *) fs_get(sizeof(UTF8C_S)); utf8c->conv_table = table; utf8c->report_err = report_err; + utf8c->free_this = free_this; return((void *) utf8c); } diff --git a/pith/filter.h b/pith/filter.h index 89e085fe..fdcaad73 100644 --- a/pith/filter.h +++ b/pith/filter.h @@ -183,7 +183,7 @@ void gf_qp_8bit(FILTER_S *, int); void gf_8bit_qp(FILTER_S *, int); void gf_convert_8bit_charset(FILTER_S *, int); void gf_convert_utf8_charset(FILTER_S *, int); -void *gf_convert_utf8_charset_opt(void *, int); +void *gf_convert_utf8_charset_opt(void *, int, int); void gf_2022_jp_to_euc(FILTER_S *, int); void gf_native8bitjapanese_to_2022_jp(FILTER_S *, int); void gf_euc_to_2022_jp(FILTER_S *, int); diff --git a/pith/send.c b/pith/send.c index 460f6a24..ff48de2d 100644 --- a/pith/send.c +++ b/pith/send.c @@ -4369,7 +4369,7 @@ pine_rfc822_output_body(struct mail_bodystruct *body, soutr_t f, void *s) if(table){ gf_link_filter(gf_convert_utf8_charset, - gf_convert_utf8_charset_opt(table,0)); + gf_convert_utf8_charset_opt(table,0,1)); } else{ /* else, just send it? */ diff --git a/pith/smime.c b/pith/smime.c index 9a901a82..ebafe268 100644 --- a/pith/smime.c +++ b/pith/smime.c @@ -1224,8 +1224,12 @@ smime_deinit(void) dprint((9, "smime_deinit()")); app_RAND_write_file(NULL); if (s_cert_store != NULL) X509_STORE_free(s_cert_store); +#ifdef ERR_free_strings ERR_free_strings(); +#endif /* ERR_free_strings */ +#ifdef EVP_cleanup EVP_cleanup(); +#endif /* EVP_cleanup */ free_smime_struct(&ps_global->smime); } |