apple / cups

Apple CUPS Sources
https://www.cups.org
Apache License 2.0
1.85k stars 452 forks source link

Memory leak in libcups.so.2 #6153

Open chandrakant2023 opened 7 months ago

chandrakant2023 commented 7 months ago

Found the memory leak in libcups.so.2, following is the stack from the valgrind, Any fix is available for Rocky 8 ?

==1065== 789,696 bytes in 3,656 blocks are definitely lost in loss record 18,029 of 18,033 ==1065== at 0x4C3CE4B: calloc (vg_replace_malloc.c:1328) ==1065== by 0x4B6A5FA4: cupsArrayNew3 (in /usr/lib64/libcups.so.2) ==1065== by 0x4B6ABD02: ??? (in /usr/lib64/libcups.so.2) ==1065== by 0x4B6AC3E7: cupsGetDests2 (in /usr/lib64/libcups.so.2) ==1065== by 0x4B476924: ??? (in /opt/Qt/plugins/printsupport/libcupsprintersupport.so) ==1065== by 0x4B476AB8: ??? (in /opt/Qt/plugins/printsupport/libcupsprintersupport.so) ==1065== by 0x8374099: QPrinterInfo::defaultPrinterName() (in /opt/Qt/lib/libQt5PrintSupport.so.5.15.7)

============================================

chandrakant2023 commented 6 months ago

Hi Team, I found the way to mitigate the above stack -- in cups/dest.c in static int cups_enum_dests( ..) where you return() add free(data.devices) as you data.devices point to the allocated memory by cupsArrayNew3(..) which we need to free