From 965befd7936f8a788b950d650b76f34f606fc1e1 Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Sun, 24 Dec 2017 21:54:31 -0700 Subject: * A few fixes to ical.c and mailview.c to avoid memory leaks, and add support for encodings other than quoted-printable and base64. --- pith/ical.c | 5 ++++- pith/mailview.c | 11 ++++++++--- pith/pine.hlp | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) (limited to 'pith') diff --git a/pith/ical.c b/pith/ical.c index 75212514..64731a96 100644 --- a/pith/ical.c +++ b/pith/ical.c @@ -239,7 +239,10 @@ ical_decode(char *text, unsigned short encoding) unsigned long callen; if(encoding == ENCQUOTEDPRINTABLE){ t = rfc822_qprint ((unsigned char *) text,strlen(text),&callen); - strncpy(text, t, strlen(t)); + if(t != NULL){ + strncpy(text, t, strlen(t)); + fs_give((void **) &t); + } } return text; } diff --git a/pith/mailview.c b/pith/mailview.c index 984b560f..1d92bd91 100644 --- a/pith/mailview.c +++ b/pith/mailview.c @@ -515,10 +515,15 @@ format_calendar(long int msgno, BODY *body, HANDLE_S **handlesp, int flgs, int w continue; } break; + + default: caltext = cpystr(rawtext); + } + if(caltext != NULL){ + vcal = ical_parse_text(caltext); + if(vcal != NULL) vcal->encoding = b->encoding; + b->sparep = create_body_sparep(iCalType, (void *) vcal); + fs_give((void **) &caltext); } - vcal = ical_parse_text(caltext); - if(vcal != NULL) vcal->encoding = b->encoding; - b->sparep = create_body_sparep(iCalType, (void *) vcal); } else if(get_body_sparep_type(b->sparep) == iCalType) vcal = (VCALENDAR_S *) get_body_sparep_data(b->sparep); diff --git a/pith/pine.hlp b/pith/pine.hlp index 79cb3c9f..2fa13844 100644 --- a/pith/pine.hlp +++ b/pith/pine.hlp @@ -140,7 +140,7 @@ with help text for the config screen and the composer that didn't have any reasonable place to be called from. Dummy change to get revision in pine.hlp ============= h_revision ================= -Alpine Commit 244 2017-12-24 19:13:32 +Alpine Commit 245 2017-12-24 21:54:15 ============= h_news ================= -- cgit v1.2.3-70-g09d2