]> git.eshelyaron.com Git - emacs.git/commitdiff
(imagemagick_get_animation_cache): Fix a double-free error.
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Fri, 16 Aug 2013 15:10:13 +0000 (17:10 +0200)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Fri, 16 Aug 2013 15:10:13 +0000 (17:10 +0200)
src/ChangeLog
src/image.c

index d5c97748d1ae599db986581772188f7fc9ec8936..de9724238a06d8049634142c7369e2559ec12d74 100644 (file)
@@ -1,6 +1,7 @@
 2013-08-16  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
        * image.c: Implement an ImageMagick per-image cache.
+       (imagemagick_get_animation_cache): Fix a double-free error.
 
 2013-08-16  Xue Fuqiao  <xfq.free@gmail.com>
 
index 082cc6a762a333551b35306f9cf7c63ddbe3ed62..ed10a3ed6cd13b8a6135bfc2feac5aff0b40916d 100644 (file)
@@ -7901,9 +7901,9 @@ void
 imagemagick_prune_animation_cache ()
 {
   struct animation_cache *cache = animation_cache;
-  struct animation_cache *prev;
+  struct animation_cache *prev = NULL;
   EMACS_TIME old = sub_emacs_time (current_emacs_time (),
-                                  EMACS_TIME_FROM_DOUBLE (60));
+                                  EMACS_TIME_FROM_DOUBLE (5));
 
   while (cache)
     {
@@ -7920,17 +7920,18 @@ imagemagick_prune_animation_cache ()
          cache = cache->next;
          free (this_cache);
        }
-      else {
-       prev = cache;
-       cache = cache->next;
-      }
+      else
+       {
+         prev = cache;
+         cache = cache->next;
+       }
     }
 }
 
 struct animation_cache *
 imagemagick_get_animation_cache (MagickWand *wand)
 {
-  char *signature = MagickGetImageSignature (wand);
+  char *signature = xstrdup (MagickGetImageSignature (wand));
   struct animation_cache *cache = animation_cache;
 
   imagemagick_prune_animation_cache ();