Red Hat Bugzilla – Bug 496008
Memory leak can occur in cupsd if `file' devices are configured
Last modified: 2010-03-30 04:15:15 EDT
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):
Steps to Reproduce:
1. In /etc/cups/cupsd.conf set:
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:
5. Restart cups
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?
Thanks for spotting this and reporting it.
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.