Merge pull request #3592 from aaronjanse/allocation_typo
fix allocation typo
This commit is contained in:
commit
7c48db7da8
@ -306,7 +306,7 @@ png_path_to_bitmap(const char* path, uint8_t** data, unsigned int* width, unsign
|
|||||||
unsigned char *buf = malloc(capacity);
|
unsigned char *buf = malloc(capacity);
|
||||||
if (!buf) { log_error("Out of memory reading PNG file at: %s", path); fclose(fp); return false; }
|
if (!buf) { log_error("Out of memory reading PNG file at: %s", path); fclose(fp); return false; }
|
||||||
while (!feof(fp)) {
|
while (!feof(fp)) {
|
||||||
if (pos - capacity < 1024) {
|
if (capacity - pos < 1024) {
|
||||||
capacity *= 2;
|
capacity *= 2;
|
||||||
unsigned char *new_buf = realloc(buf, capacity);
|
unsigned char *new_buf = realloc(buf, capacity);
|
||||||
if (!new_buf) {
|
if (!new_buf) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user