fix issue of allocating too little memory sometimes - lel - Farbfeld image view… | |
git clone git://git.codemadness.org/lel | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 427120811c034a11e20b665e8a0b2b0ad6b3149b | |
parent 1c42ab6acadcd9ca7e67d43c0d8f5861a06b970d | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Sat, 25 Feb 2017 19:25:48 +0100 | |
fix issue of allocating too little memory sometimes | |
Xlib requires additional padding per scanline sometimes, add this padding space | |
to ensure we have enough memory allocated. | |
Diffstat: | |
M lel.c | 2 +- | |
1 file changed, 1 insertion(+), 1 deletion(-) | |
--- | |
diff --git a/lel.c b/lel.c | |
@@ -272,7 +272,7 @@ ximage(unsigned int newwidth, unsigned int newheight) | |
xpix = XCreatePixmap(dpy, win, winwidth, winheight, depth); | |
ximg = XCreateImage(dpy, CopyFromParent, depth, ZPixmap… | |
NULL, newwidth, newheight, 32, 0); | |
- ximg->data = malloc(ximg->bytes_per_line * ximg->height); | |
+ ximg->data = malloc((ximg->bytes_per_line + ximg->bitmap_pad) … | |
scale(ximg->width, ximg->height, ximg->bytes_per_line, ximg->d… | |
XInitImage(ximg); | |
} else { |