File ImageMagick-CVE-2014-9852.patch of Package ImageMagick.8768

--- a/magick/distribute-cache.c
+++ b/magick/distribute-cache.c
@@ -326,12 +326,15 @@ MagickPrivate DistributeCacheInfo *AcquireDistributeCacheInfo(
   session_key=0;
   server_info->file=ConnectPixelCacheServer(hostname,server_info->port,
     &session_key,exception);
-  server_info->session_key=session_key;
-  (void) CopyMagickString(server_info->hostname,hostname,MaxTextExtent);
-  hostname=DestroyString(hostname);
   if (server_info->file == -1)
     server_info=DestroyDistributeCacheInfo(server_info);
-  server_info->debug=IsEventLogging();
+  else
+    {
+      server_info->session_key=session_key;
+      (void) CopyMagickString(server_info->hostname,hostname,MaxTextExtent);
+      server_info->debug=IsEventLogging();
+    }
+  hostname=DestroyString(hostname);
   return(server_info);
 }
 
@@ -398,12 +401,11 @@ MagickPrivate DistributeCacheInfo *DestroyDistributeCacheInfo(
 */
 
 static MagickBooleanType DestroyDistributeCache(SplayTreeInfo *registry,
-  int magick_unused(file),const size_t session_key)
+  const size_t session_key)
 {
   /*
     Destroy distributed pixel cache.
   */
-  magick_unreferenced(file);
   return(DeleteNodeFromSplayTree(registry,(const void *) session_key));
 }
 
@@ -829,7 +831,7 @@ static void *DistributePixelCacheClient(void *socket)
       }
       case 'd':
       {
-        status=DestroyDistributeCache(registry,client_socket,session_key);
+        status=DestroyDistributeCache(registry,session_key);
         break;
       }
       default:
openSUSE Build Service is sponsored by