emacs-devel
[Top][All Lists]
Advanced

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

Re: trunk r113947: * image.c: Fix animation cache signature memory leak.


From: Lars Magne Ingebrigtsen
Subject: Re: trunk r113947: * image.c: Fix animation cache signature memory leak.
Date: Mon, 19 Aug 2013 18:40:11 +0200
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux)

Paul Eggert <address@hidden> writes:

> Hmmm, well, then I must have tested it incorrectly.
> There was a dancing image on my screen, anyway....

But this is the code.  animation_cache starts off as NULL.  That means
that *pcache is NULL, right?  So the for loop never happens.  So cache
is still NULL, and then we dereference that and blow up.

Or am I misreading this completely?  It wouldn't be the first time...

static struct animation_cache *
imagemagick_get_animation_cache (MagickWand *wand)
{
  char *signature = MagickGetImageSignature (wand);
  struct animation_cache *cache;
  struct animation_cache **pcache = &animation_cache;

  imagemagick_prune_animation_cache ();
  cache = animation_cache;

  for (pcache = &animation_cache; *pcache; pcache = &cache->next)
    {
      cache = *pcache;
      if (! cache)
        {
          *pcache = cache = imagemagick_create_cache (signature);
          break;
        }
      if (strcmp (signature, cache->signature) == 0)
        {
          DestroyString (signature);
          break;
        }
    }

  cache->update_time = current_emacs_time ();
  return cache;
}


-- 
(domestic pets only, the antidote for overdose, milk.)
  No Gnus T-Shirt for sale: http://ingebrigtsen.no/no.php
  and http://lars.ingebrigtsen.no/2013/08/twenty-years-of-september.html



reply via email to

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