summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCedric Delamarre <cedric.delamarre@scilab-enterprises.com>2016-12-08 14:36:00 +0100
committerClement DAVID <clement.david@scilab-enterprises.com>2016-12-08 15:11:12 +0100
commit258e5a48ec4242a4129910f0eb85485c0bdd0ecb (patch)
treeddc9493035f56e1eae04660d31e15809bbc2030a
parent21e3f51108492bd76611eba2d42c025c6ec33f8f (diff)
downloadscilab-258e5a48ec4242a4129910f0eb85485c0bdd0ecb.zip
scilab-258e5a48ec4242a4129910f0eb85485c0bdd0ecb.tar.gz
[matelm] invalid read and mismatch free fixed
test_run core matelm mode_nwni_profiling test_run elementary_functions cumsum mode_nwni_profiling test_run elementary_functions cumprod mode_nwni_profiling Change-Id: I137e13ed62051d8e7e8a6b750b6c1f4aa22347ca
-rw-r--r--scilab/modules/ast/src/cpp/types/double.cpp10
-rw-r--r--scilab/modules/elementary_functions/sci_gateway/cpp/sci_cumprod.cpp6
-rw-r--r--scilab/modules/elementary_functions/sci_gateway/cpp/sci_cumsum.cpp6
3 files changed, 21 insertions, 1 deletions
diff --git a/scilab/modules/ast/src/cpp/types/double.cpp b/scilab/modules/ast/src/cpp/types/double.cpp
index ecbc7ce..e57ba36 100644
--- a/scilab/modules/ast/src/cpp/types/double.cpp
+++ b/scilab/modules/ast/src/cpp/types/double.cpp
@@ -933,7 +933,15 @@ double Double::copyValue(double _dblData)
933 933
934void Double::deleteAll() 934void Double::deleteAll()
935{ 935{
936 delete[] m_pRealData; 936 if (isViewAsZComplex())
937 {
938 vFreeDoubleComplexFromPointer((doublecomplex*)m_pRealData);
939 }
940 else
941 {
942 delete[] m_pRealData;
943 }
944
937 m_pRealData = NULL; 945 m_pRealData = NULL;
938 deleteImg(); 946 deleteImg();
939} 947}
diff --git a/scilab/modules/elementary_functions/sci_gateway/cpp/sci_cumprod.cpp b/scilab/modules/elementary_functions/sci_gateway/cpp/sci_cumprod.cpp
index 85576b9..fcba87e 100644
--- a/scilab/modules/elementary_functions/sci_gateway/cpp/sci_cumprod.cpp
+++ b/scilab/modules/elementary_functions/sci_gateway/cpp/sci_cumprod.cpp
@@ -55,6 +55,12 @@ types::Function::ReturnValue sci_cumprod(types::typed_list &in, int _iRetCount,
55 return types::Function::Error; 55 return types::Function::Error;
56 } 56 }
57 57
58 if (in[0]->isDouble() && in[0]->getAs<types::Double>()->isEmpty())
59 {
60 out.push_back(types::Double::Empty());
61 return types::Function::OK;
62 }
63
58 bool isCloned = true; 64 bool isCloned = true;
59 /***** get data *****/ 65 /***** get data *****/
60 switch (in[0]->getType()) 66 switch (in[0]->getType())
diff --git a/scilab/modules/elementary_functions/sci_gateway/cpp/sci_cumsum.cpp b/scilab/modules/elementary_functions/sci_gateway/cpp/sci_cumsum.cpp
index 809bff7..ad5b0c3 100644
--- a/scilab/modules/elementary_functions/sci_gateway/cpp/sci_cumsum.cpp
+++ b/scilab/modules/elementary_functions/sci_gateway/cpp/sci_cumsum.cpp
@@ -54,6 +54,12 @@ types::Function::ReturnValue sci_cumsum(types::typed_list &in, int _iRetCount, t
54 return types::Function::Error; 54 return types::Function::Error;
55 } 55 }
56 56
57 if (in[0]->isDouble() && in[0]->getAs<types::Double>()->isEmpty())
58 {
59 out.push_back(types::Double::Empty());
60 return types::Function::OK;
61 }
62
57 bool isCloned = true; 63 bool isCloned = true;
58 /***** get data *****/ 64 /***** get data *****/
59 switch (in[0]->getType()) 65 switch (in[0]->getType())