From bd8d5f6288213e0a3761fd275e9e5a1bfd8b0d28 Mon Sep 17 00:00:00 2001 From: Aaron Janse Date: Sat, 8 May 2021 01:51:29 -0700 Subject: [PATCH] fix allocation typo --- kitty/graphics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kitty/graphics.c b/kitty/graphics.c index 244e028ef..e5d5b11f4 100644 --- a/kitty/graphics.c +++ b/kitty/graphics.c @@ -306,7 +306,7 @@ png_path_to_bitmap(const char* path, uint8_t** data, unsigned int* width, unsign unsigned char *buf = malloc(capacity); if (!buf) { log_error("Out of memory reading PNG file at: %s", path); fclose(fp); return false; } while (!feof(fp)) { - if (pos - capacity < 1024) { + if (capacity - pos < 1024) { capacity *= 2; unsigned char *new_buf = realloc(buf, capacity); if (!new_buf) {