Fixed reported SVACE error in hyphenation-impl.cpp 52/258152/2
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 11 May 2021 09:01:01 +0000 (10:01 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 11 May 2021 12:27:55 +0000 (13:27 +0100)
Change-Id: I6a7bc8ce2abeae871cd294477ebb1458eb53bb36

dali/internal/text/text-abstraction/hyphenation-impl.cpp

index eef2fe9..bc460ee 100644 (file)
@@ -165,17 +165,19 @@ struct Hyphenation::Plugin
     }
 
     hyphens = (char*)malloc(wordLength + 5);
+    if(hyphens)
+    {
+      hnj_hyphen_hyphenate2(dict, (char*)(word), wordLength, hyphens, NULL, &rep, &pos, &cut);
 
-    hnj_hyphen_hyphenate2(dict, (char*)(word), wordLength, hyphens, NULL, &rep, &pos, &cut);
+      hyphensList.PushBack(false);
 
-    hyphensList.PushBack(false);
+      for(Length i = 0; i < wordLength - 1; i++)
+      {
+        hyphensList.PushBack((bool)(hyphens[i + 1] & 1));
+      }
 
-    for(Length i = 0; i < wordLength - 1; i++)
-    {
-      hyphensList.PushBack((bool)(hyphens[i + 1] & 1));
+      free(hyphens);
     }
-
-    free(hyphens);
 #endif
 
     return hyphensList;