nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0151-grub-core-fs-fshelp.c-find_file-Set-oldnode-to-zero-.patch

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