Skip to contentSkip to conversation

missed grub_free in icon_manager

PATCH In review Vladimir Testov 2 participants 3 messages Mar 7, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 missed grub_free in icon_manager

Missed grub_free in gfxmenu/icon_manager.c

If I'm not mistaken, it should be there.

Signature · 4 lines
With best regards,
_______________________________
Vladimir Testov, ROSA Laboratory.
www.rosalab.ru
grub-core/gfxmenu/icon_manager.c +1 -0
diff -Naur grub-2.00/grub-core/gfxmenu/icon_manager.c grub-new/grub-core/gfxmenu/icon_manager.c
@@ -213,6 +213,7 @@
       icondir = grub_env_get ("icondir");
       if (icondir)
 	icon = try_loading_icon (mgr, icondir, class_name);
+      grub_free(icondir);
     }
 
   /* No icon was found.  */
#1 lore raw

grub-core/gfxmenu/icon_manager.c line 216

Quoted 4 lines · Vladimir Testov
       icondir = grub_env_get ("icondir");
       if (icondir)
grub-core/gfxmenu/icon_manager.c +1 -0
 	icon = try_loading_icon (mgr, icondir, class_name);
+      grub_free(icondir);

grub_env_get doesn't give you a personal copy but the common one. You should not free it. In fact it should have been declared as returning const char *.

#2 lore raw
Quoted 11 lines · Vladimir 'φ-coder/phcoder' Serbinenko

grub-core/gfxmenu/icon_manager.c line 216

Quoted 4 lines · Vladimir Testov
       icondir = grub_env_get ("icondir");
       if (icondir)
grub-core/gfxmenu/icon_manager.c +1 -0
 	icon = try_loading_icon (mgr, icondir, class_name);
+      grub_free(icondir);

grub_env_get doesn't give you a personal copy but the common one. You should not free it. In fact it should have been declared as returning const char *.

And actually it is. Did you disable warnings and/or -Werror? As this shouldn't even compile.