* grub-core/fs/fshelp.c (grub_fshelp_find_file): Set currnode to 0

after freeing for safety.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-05-22 08:24:27 +02:00
parent 967b2b649a
commit 021d90ecac
2 changed files with 9 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2012-05-22 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/fshelp.c (grub_fshelp_find_file): Set currnode to 0
after freeing for safety.
2012-05-21 Vladimir Serbinenko <phcoder@gmail.com> 2012-05-21 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/commands/sleep.c (do_print): Add missing grub_refresh. * grub-core/commands/sleep.c (do_print): Add missing grub_refresh.

View file

@ -129,6 +129,7 @@ grub_fshelp_find_file (const char *path, grub_fshelp_node_t rootnode,
if (type != GRUB_FSHELP_DIR) if (type != GRUB_FSHELP_DIR)
{ {
free_node (currnode); free_node (currnode);
currnode = 0;
return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory")); return grub_error (GRUB_ERR_BAD_FILE_TYPE, N_("not a directory"));
} }
@ -137,6 +138,7 @@ grub_fshelp_find_file (const char *path, grub_fshelp_node_t rootnode,
if (! found) if (! found)
{ {
free_node (currnode); free_node (currnode);
currnode = 0;
if (grub_errno) if (grub_errno)
return grub_errno; return grub_errno;
@ -153,12 +155,14 @@ grub_fshelp_find_file (const char *path, grub_fshelp_node_t rootnode,
{ {
free_node (currnode); free_node (currnode);
free_node (oldnode); free_node (oldnode);
currnode = 0;
return grub_error (GRUB_ERR_SYMLINK_LOOP, return grub_error (GRUB_ERR_SYMLINK_LOOP,
N_("too deep nesting of symlinks")); N_("too deep nesting of symlinks"));
} }
symlink = read_symlink (currnode); symlink = read_symlink (currnode);
free_node (currnode); free_node (currnode);
currnode = 0;
if (!symlink) if (!symlink)
{ {