- Fixed pycups to be more cautious when removing the Connection object from
the list (bug #567386).
This commit is contained in:
parent
b841b35dab
commit
3ea06bff64
69
system-config-printer-cupsconnection-dealloc.patch
Normal file
69
system-config-printer-cupsconnection-dealloc.patch
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
diff -up system-config-printer-1.1.17/pycups-1.9.48/cupsconnection.c.cupsconnection-dealloc system-config-printer-1.1.17/pycups-1.9.48/cupsconnection.c
|
||||||
|
--- system-config-printer-1.1.17/pycups-1.9.48/cupsconnection.c.cupsconnection-dealloc 2010-03-08 17:06:47.000000000 +0100
|
||||||
|
+++ system-config-printer-1.1.17/pycups-1.9.48/cupsconnection.c 2010-03-08 17:06:47.000000000 +0100
|
||||||
|
@@ -231,37 +231,43 @@ Connection_dealloc (Connection *self)
|
||||||
|
{
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
- if (NumConnections > 1)
|
||||||
|
- {
|
||||||
|
- Connection **new_array = calloc (NumConnections - 1,
|
||||||
|
- sizeof (Connection *));
|
||||||
|
+ for (j = 0; j < NumConnections; j++)
|
||||||
|
+ if (Connections[j] == self)
|
||||||
|
+ break;
|
||||||
|
|
||||||
|
- for (i = 0, j = 0; i < NumConnections; i++)
|
||||||
|
+ if (j < NumConnections)
|
||||||
|
+ {
|
||||||
|
+ if (NumConnections > 1)
|
||||||
|
{
|
||||||
|
- if (Connections[i] == self)
|
||||||
|
+ Connection **new_array = calloc (NumConnections - 1,
|
||||||
|
+ sizeof (Connection *));
|
||||||
|
+
|
||||||
|
+ if (new_array)
|
||||||
|
{
|
||||||
|
- if (!new_array)
|
||||||
|
- Connections[i] = NULL;
|
||||||
|
+ int k;
|
||||||
|
+ for (i = 0, k = 0; i < NumConnections; i++)
|
||||||
|
+ {
|
||||||
|
+ if (i == j)
|
||||||
|
+ continue;
|
||||||
|
|
||||||
|
- continue;
|
||||||
|
- }
|
||||||
|
+ new_array[k++] = Connections[i];
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- if (new_array)
|
||||||
|
- new_array[j++] = Connections[i];
|
||||||
|
+ free (Connections);
|
||||||
|
+ Connections = new_array;
|
||||||
|
+ NumConnections--;
|
||||||
|
+ } else
|
||||||
|
+ /* Failed to allocate memory. Just clear out the reference. */
|
||||||
|
+ Connections[j] = NULL;
|
||||||
|
}
|
||||||
|
-
|
||||||
|
- if (new_array) {
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ /* The only element is the one we no longer need. */
|
||||||
|
free (Connections);
|
||||||
|
- Connections = new_array;
|
||||||
|
- NumConnections--;
|
||||||
|
+ Connections = NULL;
|
||||||
|
+ NumConnections = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- else
|
||||||
|
- {
|
||||||
|
- free (Connections);
|
||||||
|
- Connections = NULL;
|
||||||
|
- NumConnections = 0;
|
||||||
|
- }
|
||||||
|
|
||||||
|
if (self->http) {
|
||||||
|
debugprintf ("httpClose()\n");
|
@ -7,7 +7,7 @@
|
|||||||
Summary: A printer administration tool
|
Summary: A printer administration tool
|
||||||
Name: system-config-printer
|
Name: system-config-printer
|
||||||
Version: 1.1.93
|
Version: 1.1.93
|
||||||
Release: 5%{?dist}
|
Release: 6%{?dist}
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
URL: http://cyberelk.net/tim/software/system-config-printer/
|
URL: http://cyberelk.net/tim/software/system-config-printer/
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
@ -22,6 +22,7 @@ Patch2: system-config-printer-lowercase-mfg-mdl.patch
|
|||||||
Patch3: system-config-printer-import-gobject.patch
|
Patch3: system-config-printer-import-gobject.patch
|
||||||
Patch4: system-config-printer-check-install.patch
|
Patch4: system-config-printer-check-install.patch
|
||||||
Patch5: system-config-printer-icon-name.patch
|
Patch5: system-config-printer-icon-name.patch
|
||||||
|
Patch6: system-config-printer-cupsconnection-dealloc.patch
|
||||||
|
|
||||||
BuildRequires: cups-devel >= 1.2
|
BuildRequires: cups-devel >= 1.2
|
||||||
BuildRequires: python-devel >= 2.4
|
BuildRequires: python-devel >= 2.4
|
||||||
@ -95,6 +96,9 @@ printers.
|
|||||||
# Use 'printer' icon name instead of 'gnome-dev-printer'.
|
# Use 'printer' icon name instead of 'gnome-dev-printer'.
|
||||||
%patch5 -p1 -b .icon-name
|
%patch5 -p1 -b .icon-name
|
||||||
|
|
||||||
|
# Fix pycups Connection_dealloc()
|
||||||
|
%patch6 -p1 -b .cupsconnection-dealloc
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%configure --with-udev-rules --with-polkit-1
|
%configure --with-udev-rules --with-polkit-1
|
||||||
|
|
||||||
@ -210,6 +214,10 @@ rm -rf %buildroot
|
|||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Mar 8 2010 Jiri Popelka <jpopelka@redhat.com> 1.1.93-6
|
||||||
|
- Fixed pycups to be more cautious when removing
|
||||||
|
the Connection object from the list (bug #567386).
|
||||||
|
|
||||||
* Wed Mar 3 2010 Tim Waugh <twaugh@redhat.com> - 1.1.93-5
|
* Wed Mar 3 2010 Tim Waugh <twaugh@redhat.com> - 1.1.93-5
|
||||||
- Added comments for all sources and patches.
|
- Added comments for all sources and patches.
|
||||||
- Ship COPYING files.
|
- Ship COPYING files.
|
||||||
|
Loading…
Reference in New Issue
Block a user