Fix corruption in first line of Waveshare image

This commit is contained in:
Marcos Del Sol Vives 2024-01-06 20:47:24 +01:00
parent 778a129f52
commit cdcfa63cba
No known key found for this signature in database

View file

@ -65,7 +65,7 @@ gdImagePtr img_palettize(gdImagePtr rgb, int * palette, int palette_size) {
* Note that we are storing two extra values so we don't have to do boundary checking at
* the left and right edges of the image.
*/
struct ycbcr_t * forward = malloc((gdImageSX(rgb) + 2) * sizeof(struct ycbcr_t));
struct ycbcr_t * forward = calloc(gdImageSX(rgb) + 2, sizeof(struct ycbcr_t));
if (!forward) {
free(pal_ycbcr);
gdImageDestroy(res);