From 6fb3b4f41c6ff3a9b173d0d2b1433aab0751f6b7 Mon Sep 17 00:00:00 2001 From: Csaba Kertesz Date: Wed, 18 Sep 2013 21:49:32 +0200 Subject: [PATCH] Fix a memory leak in CvNormalBayesClassifier::train() --- modules/ml/src/nbayes.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/ml/src/nbayes.cpp b/modules/ml/src/nbayes.cpp index b9a966cd1..5ad1b134d 100644 --- a/modules/ml/src/nbayes.cpp +++ b/modules/ml/src/nbayes.cpp @@ -210,6 +210,8 @@ bool CvNormalBayesClassifier::train( const CvMat* _train_data, const CvMat* _res prod_data[c2] += train_vec[c2]*val1; } } + cvReleaseMat( &responses ); + responses = 0; /* calculate avg, covariance matrix, c */ for( cls = 0; cls < nclasses; cls++ )