]> granicus.if.org Git - libass/commitdiff
Fix cache leak
authorGrigori Goronzy <greg@blackbox>
Wed, 6 Jul 2011 20:47:56 +0000 (22:47 +0200)
committerGrigori Goronzy <greg@blackbox>
Wed, 6 Jul 2011 20:47:56 +0000 (22:47 +0200)
Fixes a leak introduced with the new cache functions, caused by wrong
pointer usage.

libass/ass_cache.c

index 8a18e0af11ef550e8ff127fdb37592b78a891b94..ece9a176b409ed019148aa8cf78fb11e47949097 100644 (file)
@@ -244,7 +244,7 @@ void *ass_cache_put(Cache *cache, void *key, void *value)
     unsigned bucket = cache->hash_func(key, cache->key_size) % cache->buckets;
     CacheItem **item = &cache->map[bucket];
     while (*item)
-        *item = (*item)->next;
+        item = &(*item)->next;
     (*item) = calloc(1, sizeof(CacheItem));
     (*item)->key = malloc(cache->key_size);
     (*item)->value = malloc(cache->value_size);