+2013-08-19 Lars Magne Ingebrigtsen <larsi@gnus.org>
+
+ * image.c (imagemagick_get_animation_cache): Don't segfault on
+ each invocation.
+
2013-08-19 Paul Eggert <eggert@cs.ucla.edu>
* image.c: Fix animation cache signature memory leak.
{
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)
+ for (pcache = &animation_cache; *pcache; pcache = &cache->next)
{
- DestroyString (signature);
- break;
+ cache = *pcache;
+ if (! cache)
+ {
+ animation_cache = cache = imagemagick_create_cache (signature);
+ break;
+ }
+ if (strcmp (signature, cache->signature) == 0)
+ {
+ DestroyString (signature);
+ break;
+ }
}
}