From d06f402ecc2218b85e2290c2d2d89a1ad4a35edb Mon Sep 17 00:00:00 2001 From: Dhruv Khattar Date: Thu, 30 Jun 2016 03:33:07 +0530 Subject: [PATCH] Coverity #1321035, #1321423 fixed Change-Id: I948245f3ce6f76eb64dbaa20365b2c099ee30022 --- .../functions_manager/src/cpp/funcmanager.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/scilab/modules/functions_manager/src/cpp/funcmanager.cpp b/scilab/modules/functions_manager/src/cpp/funcmanager.cpp index c276174..3d53013 100644 --- a/scilab/modules/functions_manager/src/cpp/funcmanager.cpp +++ b/scilab/modules/functions_manager/src/cpp/funcmanager.cpp @@ -139,11 +139,8 @@ bool FuncManager::AppendModules() if (doc == NULL) { std::cout << "Error: Could not parse file " << pstTemp << std::endl; - if (encoding) - { - free(encoding); - encoding = NULL; - } + free(encoding); + encoding = NULL; FREE(pstTemp); return false; } @@ -166,6 +163,10 @@ bool FuncManager::AppendModules() { /* we found the tag name */ const char *str = (const char*)attrib->children->content; + if (name) + { + FREE(name); + } name = os_strdup(str); } else if (xmlStrEqual(attrib->name, (const xmlChar*)"activate")) @@ -217,11 +218,8 @@ bool FuncManager::AppendModules() { std::cout << "Error: Not a valid module file " << pstTemp << " (encoding not 'utf-8') Encoding '" << encoding << "' found." << std::endl; } - if (encoding) - { - free(encoding); - encoding = NULL; - } + free(encoding); + encoding = NULL; ConfigVariable::setModuleList(m_ModuleName); FREE(pstTemp); -- 1.7.9.5