Bug 12232 fixed: fix several memleaks in various filler
[scilab.git] / scilab / modules / graphic_objects / src / cpp / NgonGridMatplotDataDecomposer.cpp
index 6ca4eaa..3804001 100644 (file)
@@ -64,11 +64,14 @@ void NgonGridMatplotDataDecomposer::fillVertices(char* id, float* buffer, int bu
      * because Matplot vertex coordinates are directly computed from these values.
      */
     decomposer->fillGridVertices(buffer, bufferLength, elementsSize, coordinateMask, scale, translation, logMask, (double*) xTrans, (double*) yTrans, &zShift, numX, numY);
+
+    releaseGraphicObjectProperty(__GO_MATPLOT_SCALE__, matplotScale, jni_double_vector, 0);
+    releaseGraphicObjectProperty(__GO_MATPLOT_TRANSLATE__, matplotTranslate, jni_double_vector, 0);
 }
 
 /* To do: refactor with its parent class' same method */
 void NgonGridMatplotDataDecomposer::fillGridVertices(float* buffer, int bufferLength, int elementsSize, int coordinateMask, double* scale, double* translation, int logMask,
-    double* x, double* y, double* z, int numX, int numY)
+                                                     double* x, double* y, double* z, int numX, int numY)
 {
     double xi = 0.;
     double yj = 0.;
@@ -243,9 +246,6 @@ void NgonGridMatplotDataDecomposer::fillColors(char* id, float* buffer, int buff
 
     getGraphicObjectProperty(id, __GO_PARENT_FIGURE__, jni_string, (void**) &parentFigure);
 
-    getGraphicObjectProperty(parentFigure, __GO_COLORMAP__, jni_double_vector, (void**) &colormap);
-    getGraphicObjectProperty(parentFigure, __GO_COLORMAP_SIZE__, jni_int, (void**) &piColormapSize);
-
     getGraphicObjectProperty(id, __GO_DATA_MODEL_NUM_X__, jni_int, (void**) &piNumX);
     getGraphicObjectProperty(id, __GO_DATA_MODEL_NUM_Y__, jni_int, (void**) &piNumY);
 
@@ -257,6 +257,9 @@ void NgonGridMatplotDataDecomposer::fillColors(char* id, float* buffer, int buff
         return;
     }
 
+    getGraphicObjectProperty(parentFigure, __GO_COLORMAP__, jni_double_vector, (void**) &colormap);
+    getGraphicObjectProperty(parentFigure, __GO_COLORMAP_SIZE__, jni_int, (void**) &piColormapSize);
+
 #if PER_VERTEX_VALUES
     for (int j = 0; j < numY-1; j++)
     {
@@ -331,6 +334,8 @@ void NgonGridMatplotDataDecomposer::fillColors(char* id, float* buffer, int buff
     }
 
 #endif
+
+    releaseGraphicObjectProperty(__GO_COLORMAP__, colormap, jni_double_vector, colormapSize);
 }
 
 /*