Bug 496008 - Memory leak can occur in cupsd if `file' devices are configured
Summary: Memory leak can occur in cupsd if `file' devices are configured
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: cups
Version: 5.3
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
: ---
Assignee: Tim Waugh
QA Contact: BaseOS QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-04-15 23:08 UTC by Opher Shachar
Modified: 2010-03-30 08:15 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 536741 (view as bug list)
Environment:
Last Closed: 2010-03-30 08:15:15 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2010:0210 0 normal SHIPPED_LIVE cups bug fix update 2010-03-29 12:29:38 UTC

Description Opher Shachar 2009-04-15 23:08:09 UTC
Description of problem:
As shipped in RHEL5.3 cups-1.3.7-8 is compiled `with-lspp'.
The lspp patch for scheduler/printers.c adds this code to cupsdSetPrinterAttrs():

      printerfile = strstr(p->device_uri, "/dev/");
      if (printerfile == NULL && (strncmp(p->device_uri, "file:/", 6) == 0))
        printerfile = strdup(p->device_uri + strlen("file:/"));

Note that in the first line printerfile is made to point into an existing string, and in the third line a *new* string is allocated with strdup() - and the code does *not* free it. Also note that this duplicated sub-string is wrong: It does not include the first `/'.

A possible fix is to change the third line to:

        printerfile = p->device_uri + 5;


Version-Release number of selected component (if applicable):
cups-1.3.7-8

Steps to Reproduce:
1. In /etc/cups/cupsd.conf set:
   FileDevice Yes
2. Restart cups
3. lpadmin -p "Create Postscript file" -v file:/home/opher/dump.ps -m postscript.ppd.gz -E
4. In /etc/cups/cupsd.conf set:
   FileDevice No
5. Restart cups

Additional info:
I'm not sure when and where cupsdSetPrinterAttrs() is called and hence how much memory is leaking ... but this should be fixed.

Also, if we're at it, my system (RHEL5) is installed with selinux *disabled* so every cups restart I get this:

    E [16/Apr/2009:01:35:08 +0300] cupsdSetPrinterAttrs: Unable to get printer context

for every configured printer (225 printers currently) that have a device uri: file:/dev/null
Could you check that selinux is enabled before you log the error?

Regards,
Opher.

Comment 1 Tim Waugh 2009-05-15 11:04:43 UTC
Thanks for spotting this and reporting it.

Comment 7 errata-xmlrpc 2010-03-30 08:15:15 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2010-0210.html


Note You need to log in before you can comment on or make changes to this bug.