FREE(str) when str is NULL crashed Scilab. 43/17443/2
Adeline CARNIS [Tue, 10 Nov 2015 10:11:45 +0000 (11:11 +0100)]
To test: Demos > Graphics > 2D and 3D plots > plot2d3

Change-Id: I31b1be349649a8df52979f77ddb66877c251424d

scilab/modules/fftw/src/c/fftw_utilities.c

index 15921b1..177a3db 100644 (file)
@@ -332,7 +332,7 @@ void ExecuteFFTWPlan(enum Plan_Type type, const fftw_plan p, double *ri, double
     switch (type)
     {
         case C2C_PLAN:
-                call_fftw_execute_split_dft(p, ri, ii, ro, io);
+            call_fftw_execute_split_dft(p, ri, ii, ro, io);
             break;
         case C2R_PLAN:
             call_fftw_execute_split_dft_c2r(p, ri, ii, ro);
@@ -1333,7 +1333,10 @@ int withMKL(void)
 {
     char* str = call_fftw_export_wisdom_to_string();
     int iWithMKL = (int)(str == NULL);
-    FREE(str);
+    if (iWithMKL != 0)
+    {
+        FREE(str);
+    }
     return iWithMKL;
 }
 /*--------------------------------------------------------------------------*/