summaryrefslogtreecommitdiff
path: root/lwlib/lwlib-Xaw.c
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>2019-04-21 09:53:39 +0900
committerYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>2019-04-21 09:53:39 +0900
commit75e68b87778d0f0a803980d59793b78834443972 (patch)
tree62ecd2f3297d2177358c7e5e4b97e80494bb0202 /lwlib/lwlib-Xaw.c
parent70f3175738225252acc5041b210c5b39376af1a1 (diff)
downloademacs-75e68b87778d0f0a803980d59793b78834443972.tar.gz
* lwlib/lwlib-Xaw.c (draw_text) [HAVE_XFT]: Fix memory leak.
Diffstat (limited to 'lwlib/lwlib-Xaw.c')
-rw-r--r--lwlib/lwlib-Xaw.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lwlib/lwlib-Xaw.c b/lwlib/lwlib-Xaw.c
index 24b31fc2956..8e3a07f202f 100644
--- a/lwlib/lwlib-Xaw.c
+++ b/lwlib/lwlib-Xaw.c
@@ -170,11 +170,12 @@ draw_text (struct widget_xft_data *data, char *lbl, int inverse)
int x = inverse ? 0 : 2;
char *bp = lbl;
- data->xft_draw = XftDrawCreate (XtDisplay (data->widget),
- data->p,
- DefaultVisual (XtDisplay (data->widget),
- screen),
- DefaultColormapOfScreen (sc));
+ if (!data->xft_draw)
+ data->xft_draw = XftDrawCreate (XtDisplay (data->widget),
+ data->p,
+ DefaultVisual (XtDisplay (data->widget),
+ screen),
+ DefaultColormapOfScreen (sc));
XftDrawRect (data->xft_draw,
inverse ? &data->xft_fg : &data->xft_bg,
0, 0, data->p_width, data->p_height);