free XImage before creating a new one - sent - simple plaintext presentation tool
(HTM) git clone git://git.suckless.org/sent
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit c271dfb848f2a84711c7c4b720e492f338f1327b
(DIR) parent 2649e8d5334f7e37a1710c60fb740ecfe91b9f9e
(HTM) Author: Augusto Castelo <alpheratz99@protonmail.com>
Date: Mon, 9 Jan 2023 15:07:48 +0000
free XImage before creating a new one
ffprepare was allocating a new XImage but wasn't freeing the
previously allocated one
Diffstat:
M sent.c | 3 +++
1 file changed, 3 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/sent.c b/sent.c
@@ -270,6 +270,9 @@ ffprepare(Image *img)
if (depth < 24)
die("sent: Display color depths < 24 not supported");
+ if (img->ximg)
+ XDestroyImage(img->ximg);
+
if (!(img->ximg = XCreateImage(xw.dpy, CopyFromParent, depth, ZPixmap, 0,
NULL, width, height, 32, 0)))
die("sent: Unable to create XImage");