Last example of optim help page crashed Scilab. 17/19017/3
Adeline CARNIS [Wed, 1 Feb 2017 09:40:49 +0000 (10:40 +0100)]
Change-Id: Ia08cbdcfbfac0fb2dbe3051360d2e1c44ee23cbe

scilab/modules/optimization/sci_gateway/cpp/sci_optim.cpp

index 2bfd426..52e4375 100644 (file)
@@ -111,9 +111,9 @@ types::Function::ReturnValue sci_optim(types::typed_list &in, types::optional_li
             throw ast::ScilabException();
         }
 
-        if (_iRetCount > 7)
+        if (_iRetCount > 9)
         {
-            Scierror(78, _("%s: Wrong number of output argument(s): %d to %d expected.\n"), "optim", 1, 7);
+            Scierror(78, _("%s: Wrong number of output argument(s): %d to %d expected.\n"), "optim", 1, 9);
             throw ast::ScilabException();
         }
 
@@ -701,6 +701,7 @@ types::Function::ReturnValue sci_optim(types::typed_list &in, types::optional_li
                 {
                     piIzs[i] = (int)pDblTi->get(i);
                 }
+                pdblDzs = new double[1];
             }
             else if (wcscmp(pStr->get(0), L"td") == 0)
             {