aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen2013-08-16 17:10:13 +0200
committerLars Magne Ingebrigtsen2013-08-16 17:10:13 +0200
commit8a6f875f7e613b2910ed3355ce0f2c01fa43cb9b (patch)
treec229128b36510cf3abb966e28587d8899fbe21fa /src
parent274ff63f7f7d19c3eb0c365ed7f8347131b9f62e (diff)
downloademacs-8a6f875f7e613b2910ed3355ce0f2c01fa43cb9b.tar.gz
emacs-8a6f875f7e613b2910ed3355ce0f2c01fa43cb9b.zip
(imagemagick_get_animation_cache): Fix a double-free error.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog1
-rw-r--r--src/image.c15
2 files changed, 9 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index d5c97748d1a..de9724238a0 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,6 +1,7 @@
12013-08-16 Lars Magne Ingebrigtsen <larsi@gnus.org> 12013-08-16 Lars Magne Ingebrigtsen <larsi@gnus.org>
2 2
3 * image.c: Implement an ImageMagick per-image cache. 3 * image.c: Implement an ImageMagick per-image cache.
4 (imagemagick_get_animation_cache): Fix a double-free error.
4 5
52013-08-16 Xue Fuqiao <xfq.free@gmail.com> 62013-08-16 Xue Fuqiao <xfq.free@gmail.com>
6 7
diff --git a/src/image.c b/src/image.c
index 082cc6a762a..ed10a3ed6cd 100644
--- a/src/image.c
+++ b/src/image.c
@@ -7901,9 +7901,9 @@ void
7901imagemagick_prune_animation_cache () 7901imagemagick_prune_animation_cache ()
7902{ 7902{
7903 struct animation_cache *cache = animation_cache; 7903 struct animation_cache *cache = animation_cache;
7904 struct animation_cache *prev; 7904 struct animation_cache *prev = NULL;
7905 EMACS_TIME old = sub_emacs_time (current_emacs_time (), 7905 EMACS_TIME old = sub_emacs_time (current_emacs_time (),
7906 EMACS_TIME_FROM_DOUBLE (60)); 7906 EMACS_TIME_FROM_DOUBLE (5));
7907 7907
7908 while (cache) 7908 while (cache)
7909 { 7909 {
@@ -7920,17 +7920,18 @@ imagemagick_prune_animation_cache ()
7920 cache = cache->next; 7920 cache = cache->next;
7921 free (this_cache); 7921 free (this_cache);
7922 } 7922 }
7923 else { 7923 else
7924 prev = cache; 7924 {
7925 cache = cache->next; 7925 prev = cache;
7926 } 7926 cache = cache->next;
7927 }
7927 } 7928 }
7928} 7929}
7929 7930
7930struct animation_cache * 7931struct animation_cache *
7931imagemagick_get_animation_cache (MagickWand *wand) 7932imagemagick_get_animation_cache (MagickWand *wand)
7932{ 7933{
7933 char *signature = MagickGetImageSignature (wand); 7934 char *signature = xstrdup (MagickGetImageSignature (wand));
7934 struct animation_cache *cache = animation_cache; 7935 struct animation_cache *cache = animation_cache;
7935 7936
7936 imagemagick_prune_animation_cache (); 7937 imagemagick_prune_animation_cache ();