Also free() when loading fails

This commit is contained in:
Kovid Goyal 2021-04-03 06:41:11 +05:30
parent 11d13c406a
commit e56d259b8e
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -329,6 +329,7 @@ png_path_to_bitmap(const char* path, uint8_t** data, unsigned int* width, unsign
inflate_png_inner(&d, buf, pos);
free(buf);
if (!d.ok) {
free(d.decompressed); free(d.row_pointers);
log_error("Failed to decode PNG image at: %s", path);
return false;
}