From 6e3759fe4d883e0309084f92af0fede9068c4f29 Mon Sep 17 00:00:00 2001
From: BenceJanosSzabo <bence.janos.szabo@ericsson.com>
Date: Fri, 27 Jan 2017 10:23:02 +0100
Subject: [PATCH] Fixed uninitialised value when reading CaseFolding.txt

Change-Id: Ifbe5a21678c24ff679e80e8d0381d46457a6491a
Signed-off-by: BenceJanosSzabo <bence.janos.szabo@ericsson.com>
---
 common/UnicharPattern.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/common/UnicharPattern.cc b/common/UnicharPattern.cc
index 6b471f76f..42fe288b6 100644
--- a/common/UnicharPattern.cc
+++ b/common/UnicharPattern.cc
@@ -107,12 +107,16 @@ UnicharPattern::UnicharPattern() : mappings_head(NULL)
   // read one line at a time
   char line[1024];
   while (fgets(line, sizeof(line), fp) != NULL) {
+    // skip empty lines
+    if (strcmp(line,"\n") == 0 || strcmp(line,"\r\n") == 0) {
+      continue;
+    }
     // ignore everything after the '#' (this is the 'comment' indicator)
     char* line_end = strchr(line, '#');
     if (line_end != NULL) {
       *line_end = '\0';
     }
-    //TODO:Valgrind reports uninitialized value coming form here to remove_spaces
+    
     // each column ends with a ';', use that as the separator for strtok
     char* from_str = remove_spaces(strtok(line, ";"));
     size_t from_str_len = from_str != NULL ? strlen(from_str) : 0;
-- 
GitLab