spreadsheet: fix memleak on csvTextScan 08/20808/1
Clément DAVID [Wed, 6 Feb 2019 08:14:51 +0000 (09:14 +0100)]
Change-Id: Iae10f260463c0a92010c48cf1f20b283f75c76c7

scilab/modules/spreadsheet/src/c/splitLine.c

index de77fb3..b352565 100644 (file)
@@ -103,7 +103,9 @@ char **splitLineCSV(const char *str, const char *sep, int *toks)
     /* in a string like foo;bar;;;, replace all the ;;, not only the first and last one */
     while (strstr(substitutedstring, tokenstring_to_search) != NULL)
     {
+        char* previous = substitutedstring;
         substitutedstring = strsub(substitutedstring, tokenstring_to_search, tokenreplacement_string);
+        FREE(previous);
     }
 
     if (strncmp(substitutedstring, sep, strlen(sep)) == 0)