From 34df4732b07f2de3a3bea1eee7e5300dcaedcc42 Mon Sep 17 00:00:00 2001 From: Jiří Popelka Date: Mar 08 2010 17:03:20 +0000 Subject: - Fixed pycups to be more cautious when removing the Connection object from the list (bug #567386). --- diff --git a/system-config-printer-cupsconnection-dealloc.patch b/system-config-printer-cupsconnection-dealloc.patch new file mode 100644 index 0000000..d25f4c4 --- /dev/null +++ b/system-config-printer-cupsconnection-dealloc.patch @@ -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"); diff --git a/system-config-printer.spec b/system-config-printer.spec index 0e30255..7d16a8c 100644 --- a/system-config-printer.spec +++ b/system-config-printer.spec @@ -7,7 +7,7 @@ Summary: A printer administration tool Name: system-config-printer Version: 1.1.17 -Release: 4%{?dist} +Release: 5%{?dist} License: GPLv2+ URL: http://cyberelk.net/tim/software/system-config-printer/ Group: System Environment/Base @@ -19,6 +19,7 @@ Patch1: system-config-printer-no-epydoc.patch Patch2: system-config-printer-device-settings.patch Patch3: system-config-printer-cupsGetPPD2.patch Patch4: system-config-printer-empty-class.patch +Patch5: system-config-printer-cupsconnection-dealloc.patch BuildRequires: cups-devel >= 1.2 BuildRequires: python-devel >= 2.4 @@ -81,6 +82,7 @@ printers. %patch2 -p1 -b .device-settings %patch3 -p1 -b .cupsGetPPD2 %patch4 -p1 -b .empty-class +%patch5 -p1 -b .cupsconnection-dealloc %build %configure --with-udev-rules --with-polkit-1 @@ -197,6 +199,10 @@ rm -rf %buildroot exit 0 %changelog +* Mon Mar 8 2010 Jiri Popelka 1.1.17-5 +- Fixed pycups to be more cautious when removing + the Connection object from the list (bug #567386). + * Mon Mar 1 2010 Tim Waugh - 1.1.17-4 - Allow IPP_INTERNAL_ERROR when fetching PPD for empty class (bug #567902).