Avoid a memory leak when allocation of a pCAL buffer fails

Set the PNG_FREE_PCAL flag immediately after the allocation of the
first pCAL buffer, so that, if any one of the subsequent allocations
fail, all pCAL buffers still get deallocated by png_free_data.

Also reorder the initialization of other PNG_FREE_ flags (without
altering the semantics) to improve the overall consistency inside
the pngset.c module.

Co-authored-by: Philippe Antoine <contact@catenacyber.fr>
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
This commit is contained in:
Cosmin Truta
2023-06-20 15:09:36 +03:00
parent 82097c2108
commit f7abe3c419
2 changed files with 13 additions and 19 deletions

View File

@@ -22,6 +22,7 @@ Authors, for copyright and licensing purposes.
* Mike Klein
* Pascal Massimino
* Paul Schmidt
* Philippe Antoine
* Qiang Zhou
* Sam Bushell
* Samuel Williams