However, when the function returns with MagickFalse (such as L1902 and L1912), xref was neither passed outside to the caller function nor freed. I believe the two positions needs to free xref because xref is freed at the default case at L1931 while the 2 positions locates in another 2 cases of a switch statement. So memory leak can happen at line 1902 and 1912.
Prerequisites
Description
Potential memory leak in function WritePDFImage in coders/pdf.c, which is similar to but different from #576.
Steps to Reproduce
xref is allocated at line L1362 or reallocated at line L1499.
However, when the function returns with MagickFalse (such as L1902 and L1912), xref was neither passed outside to the caller function nor freed. I believe the two positions needs to free xref because xref is freed at the default case at L1931 while the 2 positions locates in another 2 cases of a switch statement. So memory leak can happen at line 1902 and 1912.
There are many similar positions including L1965, L2011, L2021, L2082, L2179, L2427, L2437, L2488, L2529, L2539, L2594, L2682 and L2894.
System Configuration
Credit to Bingchang Liu of VARAS of IIE
The text was updated successfully, but these errors were encountered: