a5bd9f6
From 6b0ffea6b4093185ae5eedc1ce115c4b1a51e65d Mon Sep 17 00:00:00 2001
a5bd9f6
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
a5bd9f6
Date: Fri, 1 Feb 2013 21:51:09 +0100
a5bd9f6
Subject: [PATCH 150/364] 	* grub-core/fs/fshelp.c (find_file): Set
a5bd9f6
 oldnode to zero after 	freeing it.
a5bd9f6
a5bd9f6
---
a5bd9f6
 ChangeLog             | 5 +++++
a5bd9f6
 grub-core/fs/fshelp.c | 8 +++++++-
a5bd9f6
 2 files changed, 12 insertions(+), 1 deletion(-)
a5bd9f6
a5bd9f6
diff --git a/ChangeLog b/ChangeLog
a5bd9f6
index 2e681c1..f5396fe 100644
a5bd9f6
--- a/ChangeLog
a5bd9f6
+++ b/ChangeLog
a5bd9f6
@@ -1,5 +1,10 @@
a5bd9f6
 2013-02-01  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
 
a5bd9f6
+	* grub-core/fs/fshelp.c (find_file): Set oldnode to zero after
a5bd9f6
+	freeing it.
a5bd9f6
+
a5bd9f6
+2013-02-01  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
+
a5bd9f6
 	Implement USBDebug (full USB stack variant).
a5bd9f6
 
a5bd9f6
 2013-02-01  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
diff --git a/grub-core/fs/fshelp.c b/grub-core/fs/fshelp.c
a5bd9f6
index 7e557c3..11a1259 100644
a5bd9f6
--- a/grub-core/fs/fshelp.c
a5bd9f6
+++ b/grub-core/fs/fshelp.c
a5bd9f6
@@ -147,6 +147,7 @@ find_file (const char *currpath, grub_fshelp_node_t currroot,
a5bd9f6
 	      free_node (ctx->currnode, ctx);
a5bd9f6
 	      free_node (ctx->oldnode, ctx);
a5bd9f6
 	      ctx->currnode = 0;
a5bd9f6
+	      ctx->oldnode = 0;
a5bd9f6
 	      return grub_error (GRUB_ERR_SYMLINK_LOOP,
a5bd9f6
 				 N_("too deep nesting of symlinks"));
a5bd9f6
 	    }
a5bd9f6
@@ -158,6 +159,7 @@ find_file (const char *currpath, grub_fshelp_node_t currroot,
a5bd9f6
 	  if (!symlink)
a5bd9f6
 	    {
a5bd9f6
 	      free_node (ctx->oldnode, ctx);
a5bd9f6
+	      ctx->oldnode = 0;
a5bd9f6
 	      return grub_errno;
a5bd9f6
 	    }
a5bd9f6
 
a5bd9f6
@@ -177,12 +179,16 @@ find_file (const char *currpath, grub_fshelp_node_t currroot,
a5bd9f6
 	  if (grub_errno)
a5bd9f6
 	    {
a5bd9f6
 	      free_node (ctx->oldnode, ctx);
a5bd9f6
+	      ctx->oldnode = 0;
a5bd9f6
 	      return grub_errno;
a5bd9f6
 	    }
a5bd9f6
 	}
a5bd9f6
 
a5bd9f6
       if (ctx->oldnode != ctx->currnode)
a5bd9f6
-	free_node (ctx->oldnode, ctx);
a5bd9f6
+	{
a5bd9f6
+	  free_node (ctx->oldnode, ctx);
a5bd9f6
+	  ctx->oldnode = 0;
a5bd9f6
+	}
a5bd9f6
 
a5bd9f6
       /* Found the node!  */
a5bd9f6
       if (! next || *next == '\0')
a5bd9f6
-- 
a5bd9f6
1.8.1.4
a5bd9f6