From: Sylvestre Ledru Date: Sat, 28 Sep 2013 11:00:28 +0000 (+0200) Subject: Fix some errors found by coverity: X-Git-Tag: 5.5.0-beta-1~43 X-Git-Url: http://gitweb.scilab.org/?p=scilab.git;a=commitdiff_plain;h=3fd369a2df452a71ea4d48a17a26041d55d078f4 Fix some errors found by coverity: * Remove memory leaks (CID 1098699, 1098702, 1098706, 1098708, 1098711) Change-Id: I03905bb40c5956bba2fa1f074cfaab700d0e9cf1 --- diff --git a/scilab/modules/spreadsheet/sci_gateway/c/sci_csvRead.c b/scilab/modules/spreadsheet/sci_gateway/c/sci_csvRead.c index 7048112..9d8de54 100644 --- a/scilab/modules/spreadsheet/sci_gateway/c/sci_csvRead.c +++ b/scilab/modules/spreadsheet/sci_gateway/c/sci_csvRead.c @@ -251,6 +251,11 @@ int sci_csvRead(char *fname, unsigned long fname_len) freeArrayOfString(toreplace, nbElementsToReplace * 2); toreplace = NULL; } + if (decimal) + { + FREE(decimal); + decimal = NULL; + } return 0; } } @@ -285,6 +290,11 @@ int sci_csvRead(char *fname, unsigned long fname_len) FREE(decimal); decimal = NULL; } + if (separator) + { + FREE(separator); + separator = NULL; + } return 0; } } @@ -330,6 +340,11 @@ int sci_csvRead(char *fname, unsigned long fname_len) FREE(decimal); decimal = NULL; } + if (filename) + { + FREE(filename); + filename = NULL; + } return 0; } @@ -514,6 +529,7 @@ int sci_csvRead(char *fname, unsigned long fname_len) } LhsVar(2) = Rhs + 2; } + FREE(result); PutLhsVar(); } } @@ -556,6 +572,11 @@ int sci_csvRead(char *fname, unsigned long fname_len) Scierror(999, _("%s: Memory allocation error.\n"), fname); } releaseObjects(result, filename, conversion); + if (iRange) + { + FREE(iRange); + iRange = NULL; + } return 0; } @@ -569,4 +590,4 @@ static void releaseObjects(csvResult *result, char* filename, char* conversion) FREE(conversion); conversion = NULL; -} \ No newline at end of file +}