fix allocation typo

This commit is contained in:
Aaron Janse 2021-05-08 01:51:29 -07:00
parent d1169a0f37
commit bd8d5f6288

View File

@ -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) {