From: Vladimir Serbinenko Date: Mon, 26 Jan 2015 08:37:01 +0000 (+0100) Subject: gfxmenu/icon_manager: Fix null pointer dereference. X-Git-Tag: 2.02-beta3~502 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bd74a925e5026cd0368b3455df8ffcf0b1b4150b;p=thirdparty%2Fgrub.git gfxmenu/icon_manager: Fix null pointer dereference. Found by: Coverity scan. --- diff --git a/grub-core/gfxmenu/icon_manager.c b/grub-core/gfxmenu/icon_manager.c index ff49ab0e0..1894682ef 100644 --- a/grub-core/gfxmenu/icon_manager.c +++ b/grub-core/gfxmenu/icon_manager.c @@ -106,8 +106,10 @@ grub_gfxmenu_icon_manager_set_theme_path (grub_gfxmenu_icon_manager_t mgr, const char *path) { /* Clear the cache if the theme path has changed. */ - if (((mgr->theme_path == 0) != (path == 0)) - || (grub_strcmp (mgr->theme_path, path) != 0)) + if (mgr->theme_path == 0 && path == 0) + return; + if (mgr->theme_path == 0 || path == 0 + || grub_strcmp (mgr->theme_path, path) != 0) grub_gfxmenu_icon_manager_clear_cache (mgr); grub_free (mgr->theme_path);