Skip Menu |

This queue is for tickets about the Net-CUPS CPAN distribution.

Report information
The Basics
Id: 99777
Status: open
Priority: 0/
Queue: Net-CUPS

People
Owner: Nobody in particular
Requestors: gregoa [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in:
  • 0.61
  • 0.62
Fixed in: (no value)



Subject: Segfault: bad free() when finalizing the result of getDestinations()
We got a bug report in Debian about a segfault in Net::CUPS: https://bugs.debian.org/766357 It seems related to printer instances ($printer/$instance), and the problem seems to be that cupsGetDests() uses the same name. There's also a preliminary patch in the bug report. Cheers, gregor, Debian Perl Group
The preliminary patch in a good hint and I committed it for now as it does improve the situation. To be included in the next version. I've spent a couple hours today trying to find out, what the real fix should look like. The source of the issue is that the CUPS API actually doesn't give you a way to get a single printer (destination in CUPS lingo). Instead, you always deal with lists of destinations and you can only free() the whole list (using cupsFreeDests). This does not match with Net::CUPS' structure in which Net::CUPS::Destination objects are independent of each other. The proper fix will be to add a Net::CUPS::Destinations wrapper for the whole list and have Net::CUPS::Destination objects reference this list and index into it. This way Net::CUPS::Destinations' destructor can free the whole list when the last reference to it goes away.
I included your patch in the just released 0.63. Will keep the ticket open as a reminder for me that there's still a real fix waiting to be implemented. Thanks for the patch!