]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
search: fix use after free
authorAndrei Borzenkov <arvidjaar@gmail.com>
Sat, 20 Jun 2015 20:38:17 +0000 (23:38 +0300)
committerAndrei Borzenkov <arvidjaar@gmail.com>
Sat, 20 Jun 2015 20:38:17 +0000 (23:38 +0300)
Found by: Coverity scan.
CID: 96715

grub-core/commands/search.c

index 16143a34c83345d9e0b278f49f957d3a697a2b40..440303a4edc55ed4ec9dee7d4f4fa1fff9abfd9b 100644 (file)
@@ -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;
        }
     }