diff options
-rw-r--r-- | alpine/alpine.c | 14 | ||||
-rw-r--r-- | alpine/imap.c | 24 | ||||
-rw-r--r-- | alpine/imap.h | 3 | ||||
-rw-r--r-- | alpine/send.c | 4 | ||||
-rw-r--r-- | alpine/status.c | 20 | ||||
-rw-r--r-- | alpine/status.h | 1 | ||||
-rw-r--r-- | imap/src/c-client/mail.c | 5 | ||||
-rw-r--r-- | imap/src/c-client/mail.h | 2 | ||||
-rw-r--r-- | imap/src/osdep/nt/env_nt.c | 9 | ||||
-rw-r--r-- | imap/src/osdep/nt/env_nt.h | 1 | ||||
-rw-r--r-- | imap/src/osdep/unix/env_unix.c | 23 | ||||
-rw-r--r-- | imap/src/osdep/unix/env_unix.h | 1 | ||||
-rw-r--r-- | imap/src/osdep/unix/ssl_unix.c | 4 | ||||
-rw-r--r-- | pico/efunc.h | 1 | ||||
-rw-r--r-- | pico/line.c | 4 | ||||
-rw-r--r-- | pico/pico.c | 17 | ||||
-rw-r--r-- | pith/filter.c | 15 | ||||
-rw-r--r-- | pith/filter.h | 2 | ||||
-rw-r--r-- | pith/ical.c | 83 | ||||
-rw-r--r-- | pith/ical.h | 1 | ||||
-rw-r--r-- | pith/mailview.c | 17 | ||||
-rw-r--r-- | pith/send.c | 6 | ||||
-rw-r--r-- | pith/state.c | 8 | ||||
-rw-r--r-- | pith/state.h | 2 | ||||
-rw-r--r-- | pith/string.c | 6 |
25 files changed, 228 insertions, 45 deletions
diff --git a/alpine/alpine.c b/alpine/alpine.c index d762059b..c5f64d74 100644 --- a/alpine/alpine.c +++ b/alpine/alpine.c @@ -97,6 +97,7 @@ void pine_read_progress(GETS_DATA *, unsigned long); int remote_pinerc_failure(void); void dump_supported_options(void); int prune_folders_ok(void); +void free_alpine_module_globals(void); #ifdef WIN32 char *pine_user_callback(void); #endif @@ -3293,6 +3294,11 @@ goodnight_gracey(struct pine *pine_state, int exit_val) free_histlist(); + free_alpine_module_globals(); /* should we have module globals? */ + free_pith_module_globals(); + free_pico_module_globals(); + free_c_client_module_globals(); + #ifdef DEBUG if(debugfile){ if(debug >= 2) @@ -3538,6 +3544,14 @@ prune_folders_ok(void) return(1); } +void +free_alpine_module_globals(void) +{ +#ifdef LOCAL_PASSWD_CACHE + free_passfile_cache(); +#endif + free_message_queue(); +} #ifdef WIN32 char * diff --git a/alpine/imap.c b/alpine/imap.c index 5b107600..48ee3606 100644 --- a/alpine/imap.c +++ b/alpine/imap.c @@ -106,6 +106,7 @@ int read_passfile(char *, MMLOGIN_S **); void write_passfile(char *, MMLOGIN_S *); int preserve_prompt(char *); void update_passfile_hostlist(char *, char *, STRLIST_S *, int); +void free_passfile_cache_work(MMLOGIN_S **); static MMLOGIN_S *passfile_cache = NULL; static int using_passfile = -1; @@ -2713,8 +2714,29 @@ get_passfile_passwd(pinerc, passwd, user, hostlist, altflag) : 0); } +void +free_passfile_cache_work(MMLOGIN_S **pwdcache) +{ + if(pwdcache == NULL || *pwdcache == NULL) + return; + + if((*pwdcache)->user) fs_give((void **)&(*pwdcache)->user); +// if((*pwdcache)->passwd) fs_give((void **)&(*pwdcache)->passwd); + if((*pwdcache)->hosts) free_strlist(&(*pwdcache)->hosts); + free_passfile_cache_work(&(*pwdcache)->next); + fs_give((void **)pwdcache); +} + + +void +free_passfile_cache(void) +{ + if(passfile_cache) + free_passfile_cache_work(&passfile_cache); +} + int -is_using_passfile() +is_using_passfile(void) { return(using_passfile == 1); } diff --git a/alpine/imap.h b/alpine/imap.h index bd5960f0..08f51ce5 100644 --- a/alpine/imap.h +++ b/alpine/imap.h @@ -34,9 +34,10 @@ void mm_expunged_current(long unsigned int); #ifdef LOCAL_PASSWD_CACHE int get_passfile_passwd(char *, char *, char *, STRLIST_S *, int); -int is_using_passfile(); +int is_using_passfile(void); void set_passfile_passwd(char *, char *, char *, STRLIST_S *, int, int); char *get_passfile_user(char *, STRLIST_S *); +void free_passfile_cache(void); #endif /* LOCAL_PASSWD_CACHE */ #if (WINCRED > 0) diff --git a/alpine/send.c b/alpine/send.c index c7763bfd..496824f4 100644 --- a/alpine/send.c +++ b/alpine/send.c @@ -2170,9 +2170,7 @@ pine_send(ENVELOPE *outgoing, struct mail_bodystruct **body, pf->name = cpystr(pf_template[index].name); if(index == N_SENDER && F_ON(F_USE_SENDER_NOT_X, ps_global)) /* slide string over so it is Sender instead of X-X-Sender */ - for(p=pf->name; *(p+1); p++) - *p = *(p+4); - + memmove(pf->name, pf->name+4, strlen(pf->name)-4+1); pf->type = pf_template[index].type; pf->canedit = pf_template[index].canedit; pf->rcptto = pf_template[index].rcptto; diff --git a/alpine/status.c b/alpine/status.c index ab24c71d..1c5d3595 100644 --- a/alpine/status.c +++ b/alpine/status.c @@ -1280,3 +1280,23 @@ modal_bogus_input(UCS ch) Writechar(BELL, 0); return(0); } + +void +free_message_queue(void) +{ + SMQ_T *m, *mnext; + + if(message_queue == NULL) + return; + + m = message_queue; + do{ + if(m->text) + fs_give((void **) &m->text); + + mnext = m->next; + fs_give((void **) &m); + m = mnext; + } while(m != message_queue); + message_queue = NULL; +} diff --git a/alpine/status.h b/alpine/status.h index 240c4f91..45f0a36b 100644 --- a/alpine/status.h +++ b/alpine/status.h @@ -28,6 +28,7 @@ void flush_ordered_messages(void); int status_message_write(char *, int); void mark_status_dirty(void); void mark_status_unknown(void); +void free_message_queue(void); #endif /* PINE_STATUS_INCLUDED */ diff --git a/imap/src/c-client/mail.c b/imap/src/c-client/mail.c index f989e5d9..02519e5a 100644 --- a/imap/src/c-client/mail.c +++ b/imap/src/c-client/mail.c @@ -6402,3 +6402,8 @@ char *net_localhost (NETSTREAM *stream) { return (*stream->dtb->localhost) (stream->stream); } + +void free_c_client_module_globals(void) +{ + env_end(); +} diff --git a/imap/src/c-client/mail.h b/imap/src/c-client/mail.h index f8d44033..11ebdbc9 100644 --- a/imap/src/c-client/mail.h +++ b/imap/src/c-client/mail.h @@ -1883,7 +1883,7 @@ char *sm_read (char *sbname,void **sdb); void ssl_onceonlyinit (void); char *ssl_start_tls (char *s); void ssl_server_init (char *server); - +void free_c_client_module_globals(void); /* Server I/O functions */ diff --git a/imap/src/osdep/nt/env_nt.c b/imap/src/osdep/nt/env_nt.c index d28d30a3..50063ad6 100644 --- a/imap/src/osdep/nt/env_nt.c +++ b/imap/src/osdep/nt/env_nt.c @@ -769,3 +769,12 @@ void *mm_blocknotify (int reason,void *data) } return ret; } + +void env_end(void) +{ + if(myUserName) fs_give((void **) &myUserName); + if(myLocalHost) fs_give((void **) &myLocalHost); + if(myHomeDir) fs_give((void **) &myHomeDir); + if(myNewsrc) fs_give((void **) &myNewsrc); + if(sysInbox) fs_give((void **) &sysInbox); +} diff --git a/imap/src/osdep/nt/env_nt.h b/imap/src/osdep/nt/env_nt.h index dd52f7bc..32b54474 100644 --- a/imap/src/osdep/nt/env_nt.h +++ b/imap/src/osdep/nt/env_nt.h @@ -66,6 +66,7 @@ void unlockfd (int fd,char *lock); long safe_write (int fd,char *buf,long nbytes); void *mm_blocknotify (int reason,void *data); long random (void); +void env_end(void); #if _MSC_VER < 700 #define getpid random #endif diff --git a/imap/src/osdep/unix/env_unix.c b/imap/src/osdep/unix/env_unix.c index 89e50921..44aed22f 100644 --- a/imap/src/osdep/unix/env_unix.c +++ b/imap/src/osdep/unix/env_unix.c @@ -1854,3 +1854,26 @@ void *mm_blocknotify (int reason,void *data) } return ret; } + +void env_end(void) +{ + if(myUserName) fs_give((void **)&myUserName); + if(myHomeDir) fs_give((void **)&myHomeDir); + if(ftpHome) fs_give((void **)&ftpHome); + if(myServerName) fs_give((void **)&myServerName); + if(myLocalHost) fs_give((void **)&myLocalHost); + if(myNewsrc) fs_give((void **)&myNewsrc); + if(mailsubdir) fs_give((void **)&mailsubdir); + if(sysInbox) fs_give((void **)&sysInbox); + if(newsActive) fs_give((void **)&newsActive); + if(newsSpool) fs_give((void **)&newsSpool); + if(blackBoxDir) fs_give((void **)&blackBoxDir); + if(blackBoxDefaultHome) + fs_give((void **)&blackBoxDefaultHome); + if(sslCApath) fs_give((void **)&sslCApath); + if(userFlags){ + int i; + for(i = 0; i < NUSERFLAGS; i++) + if(userFlags[i]) fs_give((void **)&userFlags[i]); + } +} diff --git a/imap/src/osdep/unix/env_unix.h b/imap/src/osdep/unix/env_unix.h index 087430ab..c45cb32d 100644 --- a/imap/src/osdep/unix/env_unix.h +++ b/imap/src/osdep/unix/env_unix.h @@ -90,3 +90,4 @@ long loginpw (struct passwd *pw,int argc,char *argv[]); long pw_login (struct passwd *pw,char *auser,char *user,char *home,int argc, char *argv[]); void *mm_blocknotify (int reason,void *data); +void env_end(void); diff --git a/imap/src/osdep/unix/ssl_unix.c b/imap/src/osdep/unix/ssl_unix.c index 4c4d6ef8..ea2df896 100644 --- a/imap/src/osdep/unix/ssl_unix.c +++ b/imap/src/osdep/unix/ssl_unix.c @@ -404,12 +404,14 @@ static char *ssl_validate_cert (X509 *cert,char *host) "Server name does not match certificate"; /* if mismatch, see if in extensions */ if (ret && (ext = X509_get_ext_d2i (cert,NID_subject_alt_name,NIL,NIL)) && - (n = sk_GENERAL_NAME_num (ext))) + (n = sk_GENERAL_NAME_num (ext))){ /* older versions of OpenSSL use "ia5" instead of dNSName */ for (i = 0; ret && (i < n); i++) if ((name = sk_GENERAL_NAME_value (ext,i)) && (name->type = GEN_DNS) && (s = name->d.ia5->data) && ssl_compare_hostnames (host,s)) ret = NIL; + sk_GENERAL_NAME_pop_free(ext, GENERAL_NAME_free); + } } else ret = "Unable to locate common name in certificate"; return ret; diff --git a/pico/efunc.h b/pico/efunc.h index 95f5fc08..bcdcb23b 100644 --- a/pico/efunc.h +++ b/pico/efunc.h @@ -209,6 +209,7 @@ extern int ctrlg(int, int); extern int rdonly(void); extern int pico_help(char **, char *, int); extern void zotedit(void); +extern void free_pico_module_globals(void); #ifdef _WINDOWS int composer_file_drop(int, int, char *); int pico_cursor(int, long); diff --git a/pico/line.c b/pico/line.c index 807c7a23..57c39b04 100644 --- a/pico/line.c +++ b/pico/line.c @@ -90,7 +90,9 @@ lalloc(int used) lp->l_size = size; lp->l_used = used; - lp->l_sig = 0; /* assume it is not a signature line */ + lp->l_sig = 0; /* assume it is not a signature line */ + lp->l_text[0].c = '\0'; /* this is not necessary */ + lp->l_text[0].a = lp->l_text[0].d = 0; /* but it makes valgrind happy */ return (lp); } diff --git a/pico/pico.c b/pico/pico.c index 2df13204..67e98596 100644 --- a/pico/pico.c +++ b/pico/pico.c @@ -1927,6 +1927,23 @@ breplace(void *w) curwp->w_flag |= WFHARD; } +void +free_pico_module_globals(void) +{ + int i; + + for(i = 0; i < 12; i++){ + if(menuitems[i].kncp) + free_color_pair(&menuitems[i].kncp); + if(menuitems[i].klcp) + free_color_pair(&menuitems[i].klcp); + if(menuitems[i].label){ + free((void *) menuitems[i].label); + menuitems[i].label = NULL; + } + } +} + #ifdef _WINDOWS /* diff --git a/pith/filter.c b/pith/filter.c index 503c6cf4..ea98a4ea 100644 --- a/pith/filter.c +++ b/pith/filter.c @@ -5346,6 +5346,10 @@ html_a_output_info(HANDLER_S *hd) if(risky && ((HTML_OPT_S *) hd->html_data->opt)->warnrisk_f) (*((HTML_OPT_S *) hd->html_data->opt)->warnrisk_f)(); + if(hd->dp) + so_give((STORE_S **) &hd->dp); + + fs_give((void **) &url); } @@ -11406,3 +11410,14 @@ gf_local_nvtnl(FILTER_S *f, int flg) } } + +void +free_filter_module_globals(void) +{ + FILTER_S *flt, *fltn = gf_master; + + while((flt = fltn) != NULL){ /* free list of old filters */ + fltn = flt->next; + fs_give((void **)&flt); + } +} diff --git a/pith/filter.h b/pith/filter.h index ce146842..89e085fe 100644 --- a/pith/filter.h +++ b/pith/filter.h @@ -217,6 +217,6 @@ void *gf_prepend_editorial_opt(prepedtest_t, char *); void gf_nvtnl_local(FILTER_S *, int); void gf_local_nvtnl(FILTER_S *, int); void *gf_url_hilite_opt(URL_HILITE_S *, HANDLE_S **, int); - +void free_filter_module_globals(void); #endif /* PITH_FILTER_INCLUDED */ diff --git a/pith/ical.c b/pith/ical.c index b0b1a6b6..dee78f58 100644 --- a/pith/ical.c +++ b/pith/ical.c @@ -76,7 +76,7 @@ void ical_set_date(ICLINE_S *, VTIMEZONE_S *); void ical_set_date_vevent(void *, void *); /* free properties */ -void ical_free_prop(void **, ICAL_PROP_S *); +void ical_free_prop(void ***, ICAL_PROP_S *, int); void ical_free_cline(void **); void ical_free_param(ICAL_PARAMETER_S **); void ical_free_gencline(void **); @@ -291,12 +291,11 @@ ical_remove_escapes(char **textp) } *t = '\0'; /* tie off filtered text */ t = text; /* reset t to the beginning */ - if(rv == -1) - fs_give((void **) &t); - else{ + if(rv == 0){ strncpy(*textp, t, strlen(t)); /* overwrite given text with filtered text */ (*textp)[strlen(t)] = '\0'; } + fs_give((void **) &t); return rv; } @@ -304,7 +303,8 @@ void ical_debug(char *fcn, char *text) { char piece[50]; strncpy(piece, text, 49); - dprint((9, "%s: %s", fcn, piece)); + piece[sizeof(piece)-1] = '\0'; + dprint((2, "%s: %s\n", fcn, piece)); } /*** @@ -346,6 +346,7 @@ ical_free_gencline(void **giclpv) if((*giclp)->cline) ical_free_cline((void **) &(*giclp)->cline); if((*giclp)->next) ical_free_gencline((void **) &(*giclp)->next); + fs_give((void **)giclp); } void @@ -364,7 +365,7 @@ ical_free_vcalendar(void **vcalpv) Cal_comp i; for(i = 0; i < VUnknown; i++) if((*vcalp)->comp[i]) (ical_comp[i].give)(&(*vcalp)->comp[i]); - fs_give((*vcalp)->comp); + fs_give((void **) &(*vcalp)->comp); } if((*vcalp)->uk_comp) ical_free_unknown_comp(&(*vcalp)->uk_comp); fs_give(vcalpv); @@ -377,7 +378,7 @@ ical_free_vevent(void **veventpv) if(veventp == NULL || *veventp == NULL) return; - ical_free_prop((*veventp)->prop, event_prop); + ical_free_prop(&(*veventp)->prop, event_prop, EvUnknown); if((*veventp)->uk_prop) ical_free_gencline((void **) &(*veventp)->uk_prop); if((*veventp)->valarm) ical_free_valarm((void **) &(*veventp)->valarm); fs_give(veventpv); @@ -396,7 +397,7 @@ ical_free_rrule(void **rrulepv) RRULE_S **rrulep = (RRULE_S **) rrulepv; if(rrulep && *rrulep){ - ical_free_prop((*rrulep)->prop, rrule_prop); + ical_free_prop(&(*rrulep)->prop, rrule_prop, RRUnknown); ical_free_param(&(*rrulep)->param); fs_give(rrulepv); } @@ -432,18 +433,18 @@ ical_free_vfreebusy(void **vfbpv) } void -ical_free_prop(void **propv, ICAL_PROP_S *aux_comp) +ical_free_prop(void ***propv, ICAL_PROP_S *aux_comp, int max) { int i, j; - if(propv == NULL) return; + if(propv == NULL || *propv == NULL) return; - for(i = 0; aux_comp[i].prop != NULL; i++) - if(propv[i]){ + for(i = 0; i < max; i++) + if((*propv)[i]){ for(j = 0; aux_comp[j].prop != NULL && aux_comp[j].pos != i; j++); - if(aux_comp[j].give) (aux_comp[j].give)(&propv[i]); + if(aux_comp[j].give) (aux_comp[j].give)(&(*propv)[i]); } - fs_give(propv); + fs_give((void **) propv); } @@ -455,8 +456,7 @@ ical_free_vtimezone(void **vtzpv) if(vtzp == NULL || *vtzp == NULL) return; - ical_free_prop((*vtzp)->prop, tz_comp); - + ical_free_prop(&(*vtzp)->prop, tz_comp, TZCUnknown); if((*vtzp)->uk_prop) ical_free_gencline((void **) &(*vtzp)->uk_prop); if((*vtzp)->standardc) ical_free_timezone((void **) &(*vtzp)->standardc); if((*vtzp)->daylightc) ical_free_timezone((void **) &(*vtzp)->daylightc); @@ -470,7 +470,7 @@ ical_free_timezone(void **tzpv) if(tzp == NULL || *tzp == NULL) return; - ical_free_prop((*tzp)->prop, tz_prop); + ical_free_prop(&(*tzp)->prop, tz_prop, TZPUnknown); if((*tzp)->uk_prop) ical_free_gencline((void **) &(*tzp)->uk_prop); if((*tzp)->next) ical_free_timezone((void **) &(*tzp)->next); fs_give(tzpv); @@ -478,6 +478,15 @@ ical_free_timezone(void **tzpv) void ical_free_valarm(void **valarmpv) { + VALARM_S **valarmp = (VALARM_S **) valarmpv; + int i, j; + + if(valarmp == NULL || *valarmp == NULL) return; + + ical_free_prop(&(*valarmp)->prop, alarm_prop, AlUnknown); + if((*valarmp)->uk_prop) ical_free_gencline((void **) &(*valarmp)->uk_prop); + if((*valarmp)->next) ical_free_timezone((void **) &(*valarmp)->next); + fs_give(valarmpv); } void @@ -742,6 +751,8 @@ ical_cline_from_token(void *iclp, char **text, char *token) { ICLINE_S *icl; + ical_debug("ical_cline_from_token", *text); + icl = ical_parse_line(text, token); if(iclp != NULL) @@ -817,8 +828,8 @@ ical_parse_vcalendar(char **text) s += ical_comp[i].len + 2; v = (ical_comp[i].parse)(&s); if(vcal->comp == NULL){ - vcal->comp = fs_get(VUnknown*sizeof(void *)); - memset((void *) vcal->comp, 0, VUnknown*sizeof(void *)); + vcal->comp = fs_get((VUnknown+1)*sizeof(void *)); + memset((void *) vcal->comp, 0, (VUnknown+1)*sizeof(void *)); } if(vcal->comp[ical_comp[i].pos] == NULL) @@ -973,8 +984,8 @@ ical_parse_vevent(char **text) if(event_prop[i].parse){ void *v; if(vevent->prop == NULL){ - vevent->prop = fs_get(EvUnknown*sizeof(void *)); - memset((void *)vevent->prop, 0, EvUnknown*sizeof(void *)); + vevent->prop = fs_get((EvUnknown+1)*sizeof(void *)); + memset((void *)vevent->prop, 0, (EvUnknown+1)*sizeof(void *)); } v = vevent->prop[event_prop[i].pos]; v = (event_prop[i].parse)(v , &s, event_prop[i].prop); @@ -1228,8 +1239,8 @@ ical_parse_valarm(char **text) ical_free_unknown_comp(&uk_comp); } else if(!struncmp(s, "END", t-s-1)){ s += 4; /* 4 = strlen("END:") */ - if(!struncmp(s, "ALARM\r\n", 7)){ - *text = s + 7; /* 7 = strlen("ALARM\r\n") */ + if(!struncmp(s, "VALARM\r\n", 8)){ + *text = s + 8; /* 8 = strlen("VALARM\r\n") */ return (void *) valarm; } } else{ Alarm_prop i; @@ -1239,8 +1250,8 @@ ical_parse_valarm(char **text) if(alarm_prop[i].parse){ void *v; if(valarm->prop == NULL){ - valarm->prop = fs_get(AlUnknown*sizeof(void *)); - memset((void *)valarm->prop, 0, AlUnknown*sizeof(void *)); + valarm->prop = fs_get((AlUnknown+1)*sizeof(void *)); + memset((void *)valarm->prop, 0, (AlUnknown+1)*sizeof(void *)); } v = valarm->prop[alarm_prop[i].pos]; v = (alarm_prop[i].parse)(v, &s, alarm_prop[i].prop); @@ -2086,6 +2097,11 @@ adjust_date_rrule(struct tm *dtstart, RRULE_S *rrule) void ical_initialize(void) { + static int inited = 0; + + if(inited != 0) + return; + ical_buf_len = 1024; ical_buf = fs_get(ical_buf_len+1); @@ -2093,6 +2109,8 @@ ical_initialize(void) day_zero.tm_year = 1601 - 1900; day_zero.tm_mday = 1; day_zero.tm_wday = 4; + + inited++; } /* At this time, we are going to print the date in 24 hour format @@ -2243,6 +2261,8 @@ ical_vevent_summary(VCALENDAR_S *vcal) tzid != NULL ? ")" : ""); rv->evstart[len-1] = '\0'; } + if(tzid) + fs_give((void **)&tzid); } /* end of if dtstart */ if((icl = (ICLINE_S *) vevent->prop[EvDuration]) != NULL){ @@ -2329,6 +2349,8 @@ ical_vevent_summary(VCALENDAR_S *vcal) tzid != NULL ? ")" : ""); rv->evend[len-1] = '\0'; } + if(tzid) + fs_give((void **)&tzid); } /* end of if dtend */ if((icl = (ICLINE_S *) vevent->prop[EvDtstamp]) != NULL){ @@ -2524,12 +2546,19 @@ free_vevent_summary(VEVENT_SUMMARY_S **vesy) if((*vesy)->attendee){ for(i = 0; (*vesy)->attendee[i] != NULL; i++) fs_give((void **) &(*vesy)->attendee[i]); - fs_give((void **) (*vesy)->attendee); + fs_give((void **) &(*vesy)->attendee); } if((*vesy)->description){ for(i = 0; (*vesy)->description[i] != NULL; i++) fs_give((void **) &(*vesy)->description[i]); - fs_give((void **) (*vesy)->description); + fs_give((void **) &(*vesy)->description); } fs_give((void **) vesy); } + +void +ical_free_all(void) +{ + if(ical_buf) + fs_give((void **)&ical_buf); +} diff --git a/pith/ical.h b/pith/ical.h index 7ff5865a..d1fb0b57 100644 --- a/pith/ical.h +++ b/pith/ical.h @@ -14,5 +14,6 @@ VEVENT_SUMMARY_S *ical_vevent_summary(VCALENDAR_S *); void free_vevent_summary(VEVENT_SUMMARY_S **); VCALENDAR_S *ical_parse_text(char *); /* this is the entry point */ +void ical_free_all(void); #endif /* ifndef PITH_ICAL_INCLUDED */ diff --git a/pith/mailview.c b/pith/mailview.c index 3fe1dd81..39fcfff6 100644 --- a/pith/mailview.c +++ b/pith/mailview.c @@ -156,7 +156,7 @@ format_message(long int msgno, ENVELOPE *env, struct mail_bodystruct *body, { char *decode_err = NULL; HEADER_S h; - int width; + int width, rv; clear_cur_embedded_color(); @@ -201,9 +201,14 @@ format_message(long int msgno, ENVELOPE *env, struct mail_bodystruct *body, } /* write delimiter and body */ - if(gf_puts(NEWLINE, pc) - && (decode_err = format_body(msgno, body, handlesp, &h, flgs, width, pc)) == NULL) - return(1); + if(gf_puts(NEWLINE, pc)){ + if((decode_err = format_body(msgno, body, handlesp, &h, flgs, width, pc)) == NULL) + rv = 1; + else + rv = 0; + } + clear_cur_embedded_color(); + return(rv); write_error: @@ -211,7 +216,7 @@ format_message(long int msgno, ENVELOPE *env, struct mail_bodystruct *body, if(!(flgs & FM_DISPLAY)) q_status_message1(SM_ORDER, 3, 4, _("Error writing message: %s"), decode_err ? decode_err : error_description(errno)); - + clear_cur_embedded_color(); return(0); } @@ -521,6 +526,7 @@ format_calendar(long int msgno, BODY *body, HANDLE_S **handlesp, int flgs, int w gf_puts(NEWLINE, pc); continue; } + caltext[callen] = '\0'; break; case ENCQUOTEDPRINTABLE: @@ -530,6 +536,7 @@ format_calendar(long int msgno, BODY *body, HANDLE_S **handlesp, int flgs, int w gf_puts(NEWLINE, pc); continue; } + caltext[callen] = '\0'; break; default: caltext = cpystr(rawtext); diff --git a/pith/send.c b/pith/send.c index 0c6a4085..8be908c2 100644 --- a/pith/send.c +++ b/pith/send.c @@ -4279,6 +4279,7 @@ pine_rfc822_output_body(struct mail_bodystruct *body, soutr_t f, void *s) int add_trailing_crlf; LOC_2022_JP ljp; gf_io_t gc; + void *table = NULL; dprint((4, "-- pine_rfc822_output_body: %d\n", body ? body->type : 0)); @@ -4363,7 +4364,7 @@ pine_rfc822_output_body(struct mail_bodystruct *body, soutr_t f, void *s) gf_line_test_opt(translate_utf8_to_2022_jp,&ljp)); } else{ - void *table = utf8_rmap(charset); + table = utf8_rmap(charset); if(table){ gf_link_filter(gf_convert_utf8_charset, @@ -4410,6 +4411,9 @@ pine_rfc822_output_body(struct mail_bodystruct *body, soutr_t f, void *s) display_message('x'); } + if(table) + fs_give((void **)&table); + gf_clear_so_readc(bodyso); if(encode_error || !l_flush_net(TRUE)) diff --git a/pith/state.c b/pith/state.c index 91da5bf6..5d83aba6 100644 --- a/pith/state.c +++ b/pith/state.c @@ -33,6 +33,7 @@ static char rcsid[] = "$Id: state.c 1074 2008-06-04 00:08:43Z hubert@u.washingto #include "../pith/remote.h" #include "../pith/list.h" #include "../pith/smime.h" +#include "../pith/ical.h" /* @@ -352,3 +353,10 @@ free_pinerc_s(PINERC_S **prc) fs_give((void **)prc); } } + +void +free_pith_module_globals(void) +{ + free_filter_module_globals(); + ical_free_all(); +} diff --git a/pith/state.h b/pith/state.h index f09a5b24..d0f76cbc 100644 --- a/pith/state.h +++ b/pith/state.h @@ -394,6 +394,6 @@ void free_vars(struct pine *); void free_variable_values(struct variable *); PINERC_S *new_pinerc_s(char *); void free_pinerc_s(PINERC_S **); - +void free_pith_module_globals(void); #endif /* PITH_STATE_INCLUDED */ diff --git a/pith/string.c b/pith/string.c index 0c158fb8..11a57fc0 100644 --- a/pith/string.c +++ b/pith/string.c @@ -2917,8 +2917,8 @@ free_strlist(STRLIST_S **strp) void convert_decimal_to_roman (char *rn, size_t len, long n, char l) { - char symbols[7]; - int amo[7]; + char symbols[8]; + int amo[8]; int i, j, k; rn[0] = '\0'; @@ -2932,6 +2932,7 @@ convert_decimal_to_roman (char *rn, size_t len, long n, char l) symbols[4] = l + 'x' - 'i'; symbols[5] = l + 'v' - 'i'; symbols[6] = l; + symbols[7] = '\0'; amo[0] = n/1000; n -= amo[0]*1000; amo[1] = n/500; n -= amo[1]*500; @@ -2940,6 +2941,7 @@ convert_decimal_to_roman (char *rn, size_t len, long n, char l) amo[4] = n/10; n -= amo[4]*10; amo[5] = n/5; n -= amo[5]*5; amo[6] = n; + amo[7] = 0; /* make valgrind happy */ for(i = 0, j = 0; i < len && j < strlen(symbols); j++){ if(amo[j] < 4){ |