[PATCH] discover: Initialise strtok_r saveptr to NULL

Samuel Mendoza-Jonas sam.mj at au1.ibm.com
Fri Apr 10 15:57:34 AEST 2015


Signed-off-by: Samuel Mendoza-Jonas <sam.mj at au1.ibm.com>
---
 discover/boot.c             | 2 +-
 discover/grub2/env.c        | 2 +-
 discover/platform-powerpc.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/discover/boot.c b/discover/boot.c
index 6e7fda6..7778b3f 100644
--- a/discover/boot.c
+++ b/discover/boot.c
@@ -177,7 +177,7 @@ static void boot_hook_update(struct boot_task *task, const char *hookname,
 		char *buf)
 {
 	char *line, *name, *val, *sep;
-	char *saveptr;
+	char *saveptr = NULL;
 
 	for (;; buf = NULL) {
 
diff --git a/discover/grub2/env.c b/discover/grub2/env.c
index 9de5e9f..1336824 100644
--- a/discover/grub2/env.c
+++ b/discover/grub2/env.c
@@ -17,7 +17,7 @@ static const char *signature = "# GRUB Environment Block\n";
 
 static int parse_buf_to_env(struct grub2_script *script, void *buf, int len)
 {
-	char *tmp, *line, *sep;
+	char *tmp = NULL, *line, *sep;
 	int siglen;
 
 	siglen = strlen(signature);
diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c
index 6f594e3..6315343 100644
--- a/discover/platform-powerpc.c
+++ b/discover/platform-powerpc.c
@@ -338,7 +338,7 @@ out_err:
 static int parse_one_dns_config(struct config *config,
 		char *confstr)
 {
-	char *tok, *saveptr;
+	char *tok, *saveptr = NULL;
 
 	for (tok = strtok_r(confstr, ",", &saveptr); tok;
 			tok = strtok_r(NULL, ",", &saveptr)) {
-- 
2.1.0



More information about the Petitboot mailing list