lel

farbfeld image viewer
git clone git://git.2f30.org/lel.git
Log | Files | Refs | README | LICENSE

commit 427120811c034a11e20b665e8a0b2b0ad6b3149b
parent 1c42ab6acadcd9ca7e67d43c0d8f5861a06b970d
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sat Feb 25 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:
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, 0, NULL, newwidth, newheight, 32, 0); - ximg->data = malloc(ximg->bytes_per_line * ximg->height); + ximg->data = malloc((ximg->bytes_per_line + ximg->bitmap_pad) * ximg->height); scale(ximg->width, ximg->height, ximg->bytes_per_line, ximg->data); XInitImage(ximg); } else {