- Fixed lspp-patch to avoid memory leak (bug #536741).

This commit is contained in:
Jiří Popelka 2009-11-11 09:51:45 +00:00
parent 1cf569f218
commit e0e1f21855
2 changed files with 12 additions and 6 deletions

View File

@ -1740,7 +1740,7 @@ diff -up cups-1.4.1/scheduler/ipp.c.lspp cups-1.4.1/scheduler/ipp.c
+ +
+ printerfile = strstr(printer->device_uri, "/dev/"); + printerfile = strstr(printer->device_uri, "/dev/");
+ if (printerfile == NULL && (strncmp(printer->device_uri, "file:/", 6) == 0)) + if (printerfile == NULL && (strncmp(printer->device_uri, "file:/", 6) == 0))
+ printerfile = strdup(printer->device_uri + strlen("file:/")); + printerfile = printer->device_uri + strlen("file:");
+ +
+ if (printerfile != NULL) + if (printerfile != NULL)
+ { + {
@ -2546,7 +2546,7 @@ diff -up cups-1.4.1/scheduler/job.c.lspp cups-1.4.1/scheduler/job.c
+ */ + */
+ printerfile = strstr(printer->device_uri, "/dev/"); + printerfile = strstr(printer->device_uri, "/dev/");
+ if (printerfile == NULL && (strncmp(printer->device_uri, "file:/", 6) == 0)) + if (printerfile == NULL && (strncmp(printer->device_uri, "file:/", 6) == 0))
+ printerfile = strdup(printer->device_uri + strlen("file:/")); + printerfile = printer->device_uri + strlen("file:");
+ +
+ if (printerfile != NULL) + if (printerfile != NULL)
+ { + {
@ -2776,7 +2776,7 @@ diff -up cups-1.4.1/scheduler/printers.c.lspp cups-1.4.1/scheduler/printers.c
DEBUG_printf(("cupsdSetPrinterAttrs: entering name = %s, type = %x\n", p->name, DEBUG_printf(("cupsdSetPrinterAttrs: entering name = %s, type = %x\n", p->name,
@@ -2296,6 +2309,42 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p) @@ -2296,6 +2309,45 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)
attr->values[1].string.text = _cupsStrAlloc(Classification ? attr->values[1].string.text = _cupsStrAlloc(Classification ?
Classification : p->job_sheets[1]); Classification : p->job_sheets[1]);
} }
@ -2788,12 +2788,15 @@ diff -up cups-1.4.1/scheduler/printers.c.lspp cups-1.4.1/scheduler/printers.c
+ printercon = 0; + printercon = 0;
+ printerfile = strstr(p->device_uri, "/dev/"); + printerfile = strstr(p->device_uri, "/dev/");
+ if (printerfile == NULL && (strncmp(p->device_uri, "file:/", 6) == 0)) + if (printerfile == NULL && (strncmp(p->device_uri, "file:/", 6) == 0))
+ printerfile = strdup(p->device_uri + strlen("file:/")); + printerfile = p->device_uri + strlen("file:");
+ +
+ if (printerfile != NULL) + if (printerfile != NULL)
+ { + {
+ if (getfilecon(printerfile, &devcon) == -1) + if (getfilecon(printerfile, &devcon) == -1)
+ {
+ if(is_selinux_enabled())
+ cupsdLogMessage(CUPSD_LOG_ERROR, "cupsdSetPrinterAttrs: Unable to get printer context"); + cupsdLogMessage(CUPSD_LOG_ERROR, "cupsdSetPrinterAttrs: Unable to get printer context");
+ }
+ else + else
+ { + {
+ printercon = context_new(devcon); + printercon = context_new(devcon);

View File

@ -9,7 +9,7 @@
Summary: Common Unix Printing System Summary: Common Unix Printing System
Name: cups Name: cups
Version: 1.4.2 Version: 1.4.2
Release: 2%{?dist} Release: 3%{?dist}
License: GPLv2 License: GPLv2
Group: System Environment/Daemons Group: System Environment/Daemons
Source: http://ftp.easysw.com/pub/cups/%{version}/cups-%{version}-source.tar.bz2 Source: http://ftp.easysw.com/pub/cups/%{version}/cups-%{version}-source.tar.bz2
@ -506,6 +506,9 @@ rm -rf $RPM_BUILD_ROOT
%{php_extdir}/phpcups.so %{php_extdir}/phpcups.so
%changelog %changelog
* Wed Nov 11 2009 Jiri Popelka <jpopelka@redhat.com> 1:1.4.2-3
- Fixed lspp-patch to avoid memory leak (bug #536741).
* Tue Nov 10 2009 Tim Waugh <twaugh@redhat.com> 1:1.4.2-2 * Tue Nov 10 2009 Tim Waugh <twaugh@redhat.com> 1:1.4.2-2
- Added explicit version dependency on cups-libs to cups-lpd - Added explicit version dependency on cups-libs to cups-lpd
(bug #502205). (bug #502205).