Commit b6fb186
authored
Fix memory leaks on error in ComputeGainMap() (#3336)
The "Unsupported RGB color space" path and the avifImageScale() failure
path returned directly instead of going through the cleanup label,
leaking the gainMapF[] channel buffers and the gainMapRGB pixels. Both
now set res and jump to cleanup, as documented by the comment above the
allocations.
The regression test computes a gain map with an unsupported depth (only
rejected after the allocations) and checks that the gain map image
planes are freed on error. Verified with ASan/LSan.
Co-authored-by: krishna28238-arch <319297638+krishna28238-arch@users.noreply.github.com>1 parent 115bc52 commit b6fb186
2 files changed
Lines changed: 32 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
804 | 804 | | |
805 | 805 | | |
806 | 806 | | |
807 | | - | |
| 807 | + | |
| 808 | + | |
808 | 809 | | |
809 | 810 | | |
810 | 811 | | |
| |||
825 | 826 | | |
826 | 827 | | |
827 | 828 | | |
828 | | - | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
829 | 833 | | |
830 | 834 | | |
831 | 835 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1593 | 1593 | | |
1594 | 1594 | | |
1595 | 1595 | | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
1596 | 1622 | | |
1597 | 1623 | | |
1598 | 1624 | | |
| |||
0 commit comments