rpms/system-config-printer/devel system-config-printer-cupsconnection-dealloc.patch, NONE, 1.1 system-config-printer.spec, 1.367, 1.368

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


Author: jpopelka

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

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.93-6
- 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/devel/system-config-printer.spec,v
retrieving revision 1.367
retrieving revision 1.368
diff -u -p -r1.367 -r1.368
--- system-config-printer.spec	3 Mar 2010 11:36:16 -0000	1.367
+++ system-config-printer.spec	8 Mar 2010 17:04:23 -0000	1.368
@@ -7,7 +7,7 @@
 Summary: A printer administration tool
 Name: system-config-printer
 Version: 1.1.93
-Release: 5%{?dist}
+Release: 6%{?dist}
 License: GPLv2+
 URL: http://cyberelk.net/tim/software/system-config-printer/
 Group: System Environment/Base
@@ -22,6 +22,7 @@ Patch2: system-config-printer-lowercase-
 Patch3: system-config-printer-import-gobject.patch
 Patch4: system-config-printer-check-install.patch
 Patch5: system-config-printer-icon-name.patch
+Patch6: system-config-printer-cupsconnection-dealloc.patch
 
 BuildRequires: cups-devel >= 1.2
 BuildRequires: python-devel >= 2.4
@@ -95,6 +96,9 @@ printers.
 # Use 'printer' icon name instead of 'gnome-dev-printer'.
 %patch5 -p1 -b .icon-name
 
+# Fix pycups Connection_dealloc()
+%patch6 -p1 -b .cupsconnection-dealloc
+
 %build
 %configure --with-udev-rules --with-polkit-1
 
@@ -210,6 +214,10 @@ rm -rf %buildroot
 exit 0
 
 %changelog
+* Mon Mar  8 2010 Jiri Popelka <jpopelka at 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 at redhat.com> - 1.1.93-5
 - Added comments for all sources and patches.
 - Ship COPYING files.



More information about the scm-commits mailing list