Fix font memory leak. (#57)

* Fix font memory leak.

This memory leak has always been present in sxiv.

The font opened on window.c:58 was never closed, so I closed it, fixing a 2kB memory leak.

* document changes

Co-authored-by: NRK <nrk@disroot.org>
This commit is contained in:
Sam Whitehead 2021-09-16 21:27:03 +01:00 committed by GitHub
parent 0b20783164
commit 0d8dcfd521
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View file

@ -23,6 +23,7 @@ Fixes:
* Wrong keybinding description in the manpage (#14) * Wrong keybinding description in the manpage (#14)
* .desktop entry not advertising webp support (#15) * .desktop entry not advertising webp support (#15)
* Prevent crash when embedded into transparent window (#3) * Prevent crash when embedded into transparent window (#3)
* Small memory leak (#57)
* Rare crash when showing some GIFs (#41) * Rare crash when showing some GIFs (#41)
* Rare event when nsxiv wouldn't close after window being destroyed (#53) * Rare event when nsxiv wouldn't close after window being destroyed (#53)

View file

@ -61,6 +61,7 @@ void win_init_font(const win_env_t *e, const char *fontstr)
fontheight = font->ascent + font->descent; fontheight = font->ascent + font->descent;
FcPatternGetDouble(font->pattern, FC_SIZE, 0, &fontsize); FcPatternGetDouble(font->pattern, FC_SIZE, 0, &fontsize);
barheight = fontheight + 2 * V_TEXT_PAD; barheight = fontheight + 2 * V_TEXT_PAD;
XftFontClose(e->dpy, font);
} }
void win_alloc_color(const win_env_t *e, const char *name, XftColor *col) void win_alloc_color(const win_env_t *e, const char *name, XftColor *col)