Fix memory leaks in drw

Synced from dwm.
Patch by Alex Flierl <shad0w73@freenet.de>, thanks.

(upgrade to 1df960, 2020-06-11)
This commit is contained in:
bakkeby 2020-06-25 12:54:49 +02:00
parent 419de40e2c
commit c4cac2c195
2 changed files with 6 additions and 1 deletions

View File

@ -1,4 +1,4 @@
Similar to [dwm-flexipatch](https://github.com/bakkeby/dwm-flexipatch) this dmenu 4.9 (750b30, 2019-03-03) project has a different take on patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more.
Similar to [dwm-flexipatch](https://github.com/bakkeby/dwm-flexipatch) this dmenu 4.9 (1df960, 2020-06-11) project has a different take on patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more.
For example to include the `alpha` patch then you would only need to flip this setting from 0 to 1 in [patches.h](https://github.com/bakkeby/dmenu-flexipatch/blob/master/patches.def.h):
```c

5
drw.c
View File

@ -114,6 +114,11 @@ drw_free(Drw *drw)
{
XFreePixmap(drw->dpy, drw->drawable);
XFreeGC(drw->dpy, drw->gc);
#if PANGO_PATCH
drw_font_free(drw->font);
#else
drw_fontset_free(drw->fonts);
#endif // PANGO_PATCH
free(drw);
}