Skip to content

Commit

Permalink
fix: memory leak in win_draw_bar (#444)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
2 people authored and N-R-K committed May 19, 2023
1 parent d0ec871 commit 824b2cb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion window.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 824b2cb

Please sign in to comment.