From 992277048fb4c5f380edb8e9247b7e721662ca89 Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Fri, 1 Jun 2018 21:18:28 -0600 Subject: * A few more modifications to make Valgrind happy. --- pico/composer.c | 15 ++++++++++----- pico/display.c | 10 ++++++++-- pith/adrbklib.c | 4 +++- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/pico/composer.c b/pico/composer.c index b61d5dec..8c80c4a5 100644 --- a/pico/composer.c +++ b/pico/composer.c @@ -2864,8 +2864,10 @@ PaintHeader(int line, /* physical line on screen */ display_delimiter(ComposerEditing ? 0 : 1); - if(lastc) + if(lastc){ pico_set_colorp(lastc, PSC_NONE); + free_color_pair(&lastc); + } } @@ -3372,14 +3374,14 @@ display_delimiter(int state) UCS *bufp, *buf; COLOR_PAIR *lastc = NULL; + if(ComposerTopLine - 1 >= BOTTOM()) /* silently forget it */ + return; + if(Pmaster && Pmaster->colors){ lastc = pico_get_cur_color(); pico_set_colorp(Pmaster->colors->ntcp, PSC_NONE); } - if(ComposerTopLine - 1 >= BOTTOM()) /* silently forget it */ - return; - buf = utf8_to_ucs4_cpystr((gmode & MDHDRONLY) ? "" : HDR_DELIM); if(!buf) return; @@ -3393,6 +3395,7 @@ display_delimiter(int state) if(bufp[delim_ps] == '\0' && !(gmode & MDHDRONLY)){ delim_ps = state; fs_give((void **) &buf); + if(lastc) free_color_pair(&lastc); return; /* already displayed! */ } } @@ -3412,8 +3415,10 @@ display_delimiter(int state) peeol(); fs_give((void **) &buf); - if(lastc) + if(lastc){ pico_set_colorp(lastc, PSC_NONE); + free_color_pair(&lastc); + } } diff --git a/pico/display.c b/pico/display.c index b3c99f72..2ffc78c8 100644 --- a/pico/display.c +++ b/pico/display.c @@ -3377,14 +3377,20 @@ wstripe(int line, int column, char *utf8pmt, int key) ucs4pmt = utf8_to_ucs4_cpystr(utf8pmt); l = ucs4_strlen(ucs4pmt); while(1){ - if(i >= term.t_ncol || col >= term.t_ncol || j >= l) + if(i >= term.t_ncol || col >= term.t_ncol || j >= l){ + if(lastc) free_color_pair(&lastc); + if(ucs4pmt) fs_give((void **) &ucs4pmt); return; /* equal strings */ + } if(ucs4pmt[j] == (UCS) key) j++; - if (pscr(line, i) == NULL) + if (pscr(line, i) == NULL){ + if(lastc) free_color_pair(&lastc); + if(ucs4pmt) fs_give((void **) &ucs4pmt); return; + } if(pscr(line, i)->c != ucs4pmt[j]){ if(j >= 1 && ucs4pmt[j-1] == (UCS) key) diff --git a/pith/adrbklib.c b/pith/adrbklib.c index d03ea032..b7d28e0d 100644 --- a/pith/adrbklib.c +++ b/pith/adrbklib.c @@ -1066,8 +1066,10 @@ build_abook_tries(AdrBk *ab, char *warning) } } - if(reverse) + if(reverse){ add_entry_to_trie(&ab->revfull_trie, reverse, (a_c_arg_t) entry_num); + fs_give((void **) &reverse); + } if(forward && forward != ae->fullname) fs_give((void **) &forward); -- cgit v1.2.3-70-g09d2