From 1c738820de6903886ff5452286a808cd29a80bac Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Tue, 27 Sep 2011 15:43:13 +0000 Subject: [PATCH] fixed resource leak in lsvmparser (ticket #1390) --- modules/objdetect/src/lsvmparser.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/objdetect/src/lsvmparser.cpp b/modules/objdetect/src/lsvmparser.cpp index 49724a59d4..e4ad85f809 100644 --- a/modules/objdetect/src/lsvmparser.cpp +++ b/modules/objdetect/src/lsvmparser.cpp @@ -735,9 +735,8 @@ int LSVMparser(const char * filename, CvLSVMFilterObject *** model, int *last, i //printf("parse : %s\n", filename); xmlf = fopen(filename, "rb"); - if(xmlf == NULL){ - return LSVM_PARSER_FILE_NOT_FOUND; - } + if(xmlf == NULL) + return LSVM_PARSER_FILE_NOT_FOUND; i = 0; j = 0; @@ -767,7 +766,9 @@ int LSVMparser(const char * filename, CvLSVMFilterObject *** model, int *last, i } } } - return LATENT_SVM_OK; + + fclose(xmlf); + return LATENT_SVM_OK; } int loadModel(