Close file on allocation failure

This commit is contained in:
Brad Fish 2021-11-26 12:28:49 -08:00
parent dd0b04b319
commit 7b1567cc9d

1
qoi.h
View File

@ -514,6 +514,7 @@ void *qoi_read(const char *filename, int *out_w, int *out_h, int channels) {
void *data = QOI_MALLOC(size); void *data = QOI_MALLOC(size);
if (!data) { if (!data) {
fclose(f);
return NULL; return NULL;
} }