]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
gfxmenu: fix memory leak
authorAndrei Borzenkov <arvidjaar@gmail.com>
Tue, 12 Jan 2016 18:33:34 +0000 (21:33 +0300)
committerAndrei Borzenkov <arvidjaar@gmail.com>
Tue, 12 Jan 2016 18:52:50 +0000 (21:52 +0300)
Found by: Coverity scan.
CID: 96657

grub-core/gfxmenu/gfxmenu.c

index f49fce802651dd2897b44c396a0b5590cfe6c80c..8a17dda2c595f3587065f8f7af912486c70b608f 100644 (file)
@@ -63,14 +63,14 @@ grub_gfxmenu_try (int entry, grub_menu_t menu, int nested)
     return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"),
                       "theme");
 
-  instance = grub_zalloc (sizeof (*instance));
-  if (!instance)
-    return grub_errno;
-
   err = grub_video_get_info (&mode_info);
   if (err)
     return err;
 
+  instance = grub_zalloc (sizeof (*instance));
+  if (!instance)
+    return grub_errno;
+
   if (theme_path[0] != '/' && theme_path[0] != '(')
     {
       const char *prefix;