rpms/system-config-printer/F-12 system-config-printer-cupsconnection-dealloc.patch, NONE, 1.1 system-config-printer.spec, 1.360, 1.361

Jiří Popelka jpopelka at fedoraproject.org
Mon Mar 8 17:03:21 UTC 2010


Author: jpopelka

Update of /cvs/pkgs/rpms/system-config-printer/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv3299

Modified Files:
	system-config-printer.spec 
Added Files:
	system-config-printer-cupsconnection-dealloc.patch 
Log Message:
* Mon Mar  8 2010 Jiri Popelka <jpopelka at redhat.com> 1.1.17-5
- Fixed pycups to be more cautious when removing
  the Connection object from the list (bug #567386).


system-config-printer-cupsconnection-dealloc.patch:
 cupsconnection.c |   50 ++++++++++++++++++++++++++++----------------------
 1 file changed, 28 insertions(+), 22 deletions(-)

--- NEW FILE system-config-printer-cupsconnection-dealloc.patch ---
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");


Index: system-config-printer.spec
===================================================================
RCS file: /cvs/pkgs/rpms/system-config-printer/F-12/system-config-printer.spec,v
retrieving revision 1.360
retrieving revision 1.361
diff -u -p -r1.360 -r1.361
--- system-config-printer.spec	1 Mar 2010 15:35:54 -0000	1.360
+++ system-config-printer.spec	8 Mar 2010 17:03:20 -0000	1.361
@@ -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.
 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 <jpopelka at redhat.com> 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 <twaugh at redhat.com> - 1.1.17-4
 - Allow IPP_INTERNAL_ERROR when fetching PPD for empty class (bug #567902).
 



More information about the scm-commits mailing list