summaryrefslogtreecommitdiff
path: root/navit/cache.c
diff options
context:
space:
mode:
authorrikky <rikky@ffa7fe5e-494d-0410-b361-a75ebd5db220>2010-08-17 19:44:53 +0000
committerrikky <rikky@ffa7fe5e-494d-0410-b361-a75ebd5db220>2010-08-17 19:44:53 +0000
commit6ab287d3193e141f1114d4dc680b242591f77ecf (patch)
tree3a7216ef543d3041cfa16f8b491da37ed3671c59 /navit/cache.c
parentf3a9b979b41217d9700d69e9e11ba8ef03037019 (diff)
downloadnavit-6ab287d3193e141f1114d4dc680b242591f77ecf.tar.gz
Fix:core:Fixed memory corruption in cache
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@3531 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/cache.c')
-rw-r--r--navit/cache.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/navit/cache.c b/navit/cache.c
index 0d37a06f8..50a1ad9ac 100644
--- a/navit/cache.c
+++ b/navit/cache.c
@@ -219,11 +219,12 @@ static struct cache_entry *
cache_move(struct cache *cache, struct cache_entry_list *old, struct cache_entry_list *new)
{
struct cache_entry *entry;
- entry=cache_remove_lru(NULL, old);
+ // remove from list AND cache, because next cache lookup can't read the id after trim
+ entry=cache_remove_lru(cache, old);
if (! entry)
return NULL;
entry=cache_trim(cache, entry);
- cache_insert_mru(NULL, new, entry);
+ cache_insert_mru(cache, new, entry);
return entry;
}