diff options
author | blk_750 <blk_750@noreply.codeberg.org> | 2023-05-19 15:17:02 +0200 |
---|---|---|
committer | NRK <nrk@disroot.org> | 2023-05-19 15:17:02 +0200 |
commit | 824b2cb8858b19ace3e26a0f54cf9dd740be9b59 (patch) | |
tree | 9ee80aec2e2968c2bf6fad0e26af7ece20912806 | |
parent | d0ec8716d7d4d0cfb0067290cac51b59b7fd4e42 (diff) | |
download | nsxiv-824b2cb8858b19ace3e26a0f54cf9dd740be9b59.tar.zst |
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>
-rw-r--r-- | window.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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); |