Coverity: io module resource leaks fixed 18/18318/2
Dhruv Khattar [Tue, 28 Jun 2016 20:03:28 +0000 (01:03 +0530)]
Change-Id: Ib0ba2e6d568038bf75d8addedd34c066f00f1f93

scilab/modules/io/src/cpp/loadlib.cpp

index 497eb73..c648f4a 100644 (file)
@@ -206,18 +206,30 @@ int parseLibFile(const std::wstring& _wstXML, MacroInfoList& info, std::wstring&
                 {
                     /* we found the tag name */
                     const char *str = (const char*)attrib->children->content;
+                    if (pstName)
+                    {
+                        FREE(pstName);
+                    }
                     pstName = to_wide_string(str);
                 }
                 else if (xmlStrEqual(attrib->name, (const xmlChar*)"file"))
                 {
                     /* we found the tag activate */
                     const char *str = (const char*)attrib->children->content;
+                    if (pstFileName)
+                    {
+                        FREE(pstFileName);
+                    }
                     pstFileName = to_wide_string(str);
                 }
                 else if (xmlStrEqual(attrib->name, (const xmlChar*)"md5"))
                 {
                     /* we found the tag activate */
                     const char *str = (const char*)attrib->children->content;
+                    if (pstMd5)
+                    {
+                        FREE(pstMd5);
+                    }
                     pstMd5 = to_wide_string(str);
                 }
                 attrib = attrib->next;