search: fix use after free

Found by: Coverity scan.
CID: 96715
This commit is contained in:
Andrei Borzenkov 2015-06-20 23:38:17 +03:00
parent 72ccf92c39
commit 0fb886cde9

View file

@ -210,10 +210,10 @@ try (struct search_ctx *ctx)
/* Cache entry was outdated. Remove it. */ /* Cache entry was outdated. Remove it. */
if (!ctx->count) if (!ctx->count)
{ {
*prev = cache_ent->next;
grub_free (cache_ent->key); grub_free (cache_ent->key);
grub_free (cache_ent->value); grub_free (cache_ent->value);
grub_free (cache_ent); grub_free (cache_ent);
*prev = cache_ent->next;
} }
} }