diff options
author | Eduardo Chappa <chappa@washington.edu> | 2018-06-01 21:18:28 -0600 |
---|---|---|
committer | Eduardo Chappa <chappa@washington.edu> | 2018-06-01 21:18:28 -0600 |
commit | 992277048fb4c5f380edb8e9247b7e721662ca89 (patch) | |
tree | 1ce9ea3a402d53c0622992e3c569f5c84467292e | |
parent | bd4fcf866fa5b84c658852d5ec495ef5800313ef (diff) | |
download | alpine-992277048fb4c5f380edb8e9247b7e721662ca89.tar.xz |
* A few more modifications to make Valgrind happy.
-rw-r--r-- | pico/composer.c | 15 | ||||
-rw-r--r-- | pico/display.c | 10 | ||||
-rw-r--r-- | 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); |