encode_dxa: Suspect behaviour
|Reported by:||eriktorbjorn||Owned by:||Kirben|
Since there have been some recent reports about encode_dxa claiming PNG files were not as expected on some systems, I looked a bit closer at it, and there's one thing that's puzzling me:
We call read_png_file() from within a loop. The first time we call it, neither 'image' nor 'palette' are initialized, so they may or may not be NULL.
Therefore, if read_png_file() fails the first time, we'll either get the "8-bit 256-color" warning, or we'll try and free at least one invalid pointer.
If read_png_file() succeeds, and 'palette' was automatically initialized to an invalid pointer, a new palette will be allocated, and things will work as expected, I guess. But if 'palette' was automatically initialized to NULL, it will not allocate a new palette, and then we'd get that "8-bit 256-color" warning.
At least, that's what I think would happen. I'm not all that familiar with libpng, and I don't want to experiment with it without discussing it with Kirben...
Ticket imported from: #1504440. Ticket imported from: bugs/2670.