fix: memory leak in `win_draw_bar` (#444)

Closes: https://codeberg.org/nsxiv/nsxiv/issues/410
Co-authored-by: blk_750 <blk_750@protonmail.com>
Reviewed-on: https://codeberg.org/nsxiv/nsxiv/pulls/444
Reviewed-by: NRK <nrk@disroot.org>
Co-authored-by: blk_750 <blk_750@noreply.codeberg.org>
Co-committed-by: blk_750 <blk_750@noreply.codeberg.org>
pull/445/head
blk_750 1 year ago committed by NRK
parent d0ec8716d7
commit 824b2cb885

@ -470,8 +470,10 @@ static void win_draw_bar(win_t *win)
XSetBackground(e->dpy, gc, win->bar_bg.pixel);
if ((len = strlen(r->buf)) > 0) {
if ((tw = TEXTWIDTH(win, r->buf, len)) > w)
if ((tw = TEXTWIDTH(win, r->buf, len)) > w) {
XftDrawDestroy(d);
return;
}
x = win->w - tw - H_TEXT_PAD;
w -= tw;
win_draw_text(win, d, &win->bar_fg, x, y, r->buf, len, tw);

Loading…
Cancel
Save