From ac33cd688cffd1c3fd541a67a758a84c90cf7bd7 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Tue, 1 Sep 2015 12:29:52 +0300 Subject: [PATCH] fixed memory leak in ANN (cherry picked from commit dfb49097e3013fa279d5882700601f5cabd6cbd8) --- modules/ml/src/ann_mlp.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/ml/src/ann_mlp.cpp b/modules/ml/src/ann_mlp.cpp index 7323ab57a7..69e4448169 100644 --- a/modules/ml/src/ann_mlp.cpp +++ b/modules/ml/src/ann_mlp.cpp @@ -1535,6 +1535,10 @@ void CvANN_MLP::read( CvFileStorage* fs, CvFileNode* node ) _layer_sizes = (CvMat*)cvReadByName( fs, node, "layer_sizes" ); CV_CALL( create( _layer_sizes, SIGMOID_SYM, 0, 0 )); + + cvReleaseMat( &_layer_sizes ); + _layer_sizes = NULL; + l_count = layer_sizes->cols; CV_CALL( read_params( fs, node ));