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>
This commit is contained in:
blk_750 2023-05-19 13:17:02 +00:00 committed by NRK
parent d0ec8716d7
commit 824b2cb885

View file

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