Coverity #1321227, #1321228, #1350365, #1321213, #1321216, #1321225 fixed: Non-array... 74/17974/4
Dhruv Khattar [Thu, 24 Mar 2016 15:28:46 +0000 (20:28 +0530)]
Change-Id: I84669dce731df58a75f0f346c2b1077789af2f10

scilab/modules/ast/src/cpp/operations/types_power.cpp
scilab/modules/core/sci_gateway/cpp/sci_cell.cpp
scilab/modules/elementary_functions/sci_gateway/cpp/sci_round.cpp
scilab/modules/elementary_functions/src/cpp/max.cpp
scilab/modules/elementary_functions/src/cpp/min.cpp

index 108d134..376f06b 100644 (file)
@@ -521,9 +521,9 @@ int DotPowerSpaseByDouble(Sparse* _pSp, Double* _pDouble, InternalType** _pOut)
         }
     }
 
-    delete Col;
-    delete Row;
-    delete iPositVal;
+    delete[] Col;
+    delete[] Row;
+    delete[] iPositVal;
 
     pSpTemp->finalize();
     *_pOut = pSpTemp;
@@ -613,13 +613,13 @@ int DotPowerPolyByDouble(Polynom* _pPoly, Double* _pDouble, InternalType** _pOut
         pSPOut[i]->DecreaseRef();
     }
 
-    // delete exp
-    for (int i = 0; i < iSize; i++)
+    //delete exp
+    for(int i = 0; i < iSize; i++)
     {
         delete pDblPower[i];
     }
-
-    delete pDblPower;
+    
+    delete[] pDblPower;
 
     // delete temporary polynom
     // do not delete the last SinglePoly of _pPoly setted without copy in pPolyTemp
index 44e8801..a869e85 100644 (file)
@@ -63,7 +63,7 @@ types::Function::ReturnValue sci_cell_gw(types::typed_list &in, int _iRetCount,
                 piDimsArray[i] = (int)pD->get(i);
             }
             pRetVal = new types::Cell(pD->getSize(), piDimsArray);
-            delete piDimsArray;
+            delete[] piDimsArray;
         }
     }
     else if (in.size() == 2)
index 02c8717..8914511 100644 (file)
@@ -77,7 +77,7 @@ types::Function::ReturnValue sci_round(types::typed_list &in, int _iRetCount, ty
             }
         }
 
-        delete piRankPolyIn;
+        delete[] piRankPolyIn;
 
         /***** return data *****/
         out.push_back(pPolyOut);
index 457f2ff..54e044e 100644 (file)
@@ -127,7 +127,7 @@ void max(std::vector<types::Double*> vectIn, int iOrientation, types::Double* pD
                     {
                         pDblIndex->set(i, piIndexes[i] + 1);
                     }
-                    delete piIndexes;
+                    delete[] piIndexes;
                 }
             }
         }
index 9b27a40..abf58cf 100644 (file)
@@ -127,7 +127,7 @@ void min(std::vector<types::Double*> vectIn, int iOrientation, types::Double* pD
                     {
                         pDblIndex->set(i, piIndexes[i] + 1);
                     }
-                    delete piIndexes;
+                    delete[] piIndexes;
                 }
             }
         }