summaryrefslogtreecommitdiff
path: root/pico
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2018-06-01 21:18:28 -0600
committerEduardo Chappa <chappa@washington.edu>2018-06-01 21:18:28 -0600
commit992277048fb4c5f380edb8e9247b7e721662ca89 (patch)
tree1ce9ea3a402d53c0622992e3c569f5c84467292e /pico
parentbd4fcf866fa5b84c658852d5ec495ef5800313ef (diff)
downloadalpine-992277048fb4c5f380edb8e9247b7e721662ca89.tar.xz
* A few more modifications to make Valgrind happy.
Diffstat (limited to 'pico')
-rw-r--r--pico/composer.c15
-rw-r--r--pico/display.c10
2 files changed, 18 insertions, 7 deletions
diff --git a/pico/composer.c b/pico/composer.c
index b61d5de..8c80c4a 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 b3c99f7..2ffc78c 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)