From c2593281c3ed2919f67514381be2b5137308f3af Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Wed, 8 Jul 2009 13:19:57 +0200 Subject: [PATCH] src/utils_cache.c: Make really sure to free the right cache entry. Make sure we do not try to free a (possibly some random) cache entry after removing it from the AVL tree. Potentially, this might have caused invalid free()s in some rare situations. --- src/utils_cache.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils_cache.c b/src/utils_cache.c index 60d32832..33dc6b15 100644 --- a/src/utils_cache.c +++ b/src/utils_cache.c @@ -296,6 +296,7 @@ int uc_check_timeout (void) { DEBUG ("uc_check_timeout: %s is missing but ``uninteresting''", keys[i]); + ce = NULL; status = c_avl_remove (cache_tree, keys[i], (void *) &key, (void *) &ce); if (status != 0) @@ -304,7 +305,8 @@ int uc_check_timeout (void) } sfree (keys[i]); sfree (key); - cache_free (ce); + if (ce != NULL) + cache_free (ce); continue; } -- 2.30.2