From 0fb886cde97b8b65eceece62440194523530737a Mon Sep 17 00:00:00 2001 From: Andrei Borzenkov Date: Sat, 20 Jun 2015 23:38:17 +0300 Subject: [PATCH] search: fix use after free Found by: Coverity scan. CID: 96715 --- grub-core/commands/search.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/commands/search.c b/grub-core/commands/search.c index 16143a34c..440303a4e 100644 --- a/grub-core/commands/search.c +++ b/grub-core/commands/search.c @@ -210,10 +210,10 @@ try (struct search_ctx *ctx) /* Cache entry was outdated. Remove it. */ if (!ctx->count) { + *prev = cache_ent->next; grub_free (cache_ent->key); grub_free (cache_ent->value); grub_free (cache_ent); - *prev = cache_ent->next; } }