diff options
| author | Lars Magne Ingebrigtsen | 2013-08-19 16:52:52 +0200 |
|---|---|---|
| committer | Lars Magne Ingebrigtsen | 2013-08-19 16:52:52 +0200 |
| commit | 6da26928029c4598e75a344d57c08ca85dd95f2a (patch) | |
| tree | 4e5991efaddf307817eb7a7dfbf8c990c98bbbd1 /src | |
| parent | 6e64a12bd7e8f0d57b2612a471189bce3e8efaf0 (diff) | |
| download | emacs-6da26928029c4598e75a344d57c08ca85dd95f2a.tar.gz emacs-6da26928029c4598e75a344d57c08ca85dd95f2a.zip | |
* image.c (imagemagick_get_animation_cache): Don't segfault on each invocation.
Bug introduced by 2013-08-19T07:01:37Z!eggert@cs.ucla.edu, which obviously hadn't even been
tested once.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/image.c | 28 |
2 files changed, 21 insertions, 12 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index c5a6f4d19c3..716b1177fd1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2013-08-19 Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 2 | |||
| 3 | * image.c (imagemagick_get_animation_cache): Don't segfault on | ||
| 4 | each invocation. | ||
| 5 | |||
| 1 | 2013-08-19 Paul Eggert <eggert@cs.ucla.edu> | 6 | 2013-08-19 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 7 | ||
| 3 | * image.c: Fix animation cache signature memory leak. | 8 | * image.c: Fix animation cache signature memory leak. |
diff --git a/src/image.c b/src/image.c index 68d78fc9eef..ec89ee076d9 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -7927,23 +7927,27 @@ imagemagick_get_animation_cache (MagickWand *wand) | |||
| 7927 | { | 7927 | { |
| 7928 | char *signature = MagickGetImageSignature (wand); | 7928 | char *signature = MagickGetImageSignature (wand); |
| 7929 | struct animation_cache *cache; | 7929 | struct animation_cache *cache; |
| 7930 | struct animation_cache **pcache = &animation_cache; | 7930 | struct animation_cache **pcache; |
| 7931 | 7931 | ||
| 7932 | imagemagick_prune_animation_cache (); | 7932 | imagemagick_prune_animation_cache (); |
| 7933 | cache = animation_cache; | ||
| 7934 | 7933 | ||
| 7935 | for (pcache = &animation_cache; *pcache; pcache = &cache->next) | 7934 | if (! animation_cache) |
| 7935 | animation_cache = cache = imagemagick_create_cache (signature); | ||
| 7936 | else | ||
| 7936 | { | 7937 | { |
| 7937 | cache = *pcache; | 7938 | for (pcache = &animation_cache; *pcache; pcache = &cache->next) |
| 7938 | if (! cache) | ||
| 7939 | { | ||
| 7940 | *pcache = cache = imagemagick_create_cache (signature); | ||
| 7941 | break; | ||
| 7942 | } | ||
| 7943 | if (strcmp (signature, cache->signature) == 0) | ||
| 7944 | { | 7939 | { |
| 7945 | DestroyString (signature); | 7940 | cache = *pcache; |
| 7946 | break; | 7941 | if (! cache) |
| 7942 | { | ||
| 7943 | animation_cache = cache = imagemagick_create_cache (signature); | ||
| 7944 | break; | ||
| 7945 | } | ||
| 7946 | if (strcmp (signature, cache->signature) == 0) | ||
| 7947 | { | ||
| 7948 | DestroyString (signature); | ||
| 7949 | break; | ||
| 7950 | } | ||
| 7947 | } | 7951 | } |
| 7948 | } | 7952 | } |
| 7949 | 7953 | ||