emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r113949: * image.c (imagemagick_get_animation_cache)


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] trunk r113949: * image.c (imagemagick_get_animation_cache): Don't segfault on each invocation.
Date: Mon, 19 Aug 2013 14:52:57 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113949
revision-id: address@hidden
parent: address@hidden
committer: Lars Magne Ingebrigtsen <address@hidden>
branch nick: trunk
timestamp: Mon 2013-08-19 16:52:52 +0200
message:
  * image.c (imagemagick_get_animation_cache): Don't segfault on each 
invocation.
  
  Bug introduced by revno 113947, which obviously hadn't even been
  tested once.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/image.c                    image.c-20091113204419-o5vbwnq5f7feedwu-2969
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-08-19 07:01:37 +0000
+++ b/src/ChangeLog     2013-08-19 14:52:52 +0000
@@ -1,3 +1,8 @@
+2013-08-19  Lars Magne Ingebrigtsen  <address@hidden>
+
+       * image.c (imagemagick_get_animation_cache): Don't segfault on
+       each invocation.
+
 2013-08-19  Paul Eggert  <address@hidden>
 
        * image.c: Fix animation cache signature memory leak.

=== modified file 'src/image.c'
--- a/src/image.c       2013-08-19 07:01:37 +0000
+++ b/src/image.c       2013-08-19 14:52:52 +0000
@@ -7927,23 +7927,27 @@
 {
   char *signature = MagickGetImageSignature (wand);
   struct animation_cache *cache;
-  struct animation_cache **pcache = &animation_cache;
+  struct animation_cache **pcache;
 
   imagemagick_prune_animation_cache ();
-  cache = animation_cache;
 
-  for (pcache = &animation_cache; *pcache; pcache = &cache->next)
+  if (! animation_cache)
+    animation_cache = cache = imagemagick_create_cache (signature);
+  else
     {
-      cache = *pcache;
-      if (! cache)
-       {
-         *pcache = cache = imagemagick_create_cache (signature);
-         break;
-       }
-      if (strcmp (signature, cache->signature) == 0)
-       {
-         DestroyString (signature);
-         break;
+      for (pcache = &animation_cache; *pcache; pcache = &cache->next)
+       {
+         cache = *pcache;
+         if (! cache)
+           {
+             animation_cache = cache = imagemagick_create_cache (signature);
+             break;
+           }
+         if (strcmp (signature, cache->signature) == 0)
+           {
+             DestroyString (signature);
+             break;
+           }
        }
     }
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]