From: Andrei Borzenkov Date: Sat, 20 Jun 2015 20:38:17 +0000 (+0300) Subject: search: fix use after free X-Git-Tag: 2.02-beta3~275 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0fb886cde97b8b65eceece62440194523530737a;p=thirdparty%2Fgrub.git search: fix use after free Found by: Coverity scan. CID: 96715 --- 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; } }