From cef8f6bb9785916ff5ed08f6a7aa9cfed73f8fa9 Mon Sep 17 00:00:00 2001 From: Julien Michel <julien.michel@orfeo-toolbox.org> Date: Fri, 30 Jan 2015 13:48:10 +0100 Subject: [PATCH] COV: Fixing coverity issue 1266744 (Ressource leak) --- .../Code/IO/otbImageFileReaderTestSensorPixelValue.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Testing/Code/IO/otbImageFileReaderTestSensorPixelValue.cxx b/Testing/Code/IO/otbImageFileReaderTestSensorPixelValue.cxx index ae2a6fc57f..a28233126d 100644 --- a/Testing/Code/IO/otbImageFileReaderTestSensorPixelValue.cxx +++ b/Testing/Code/IO/otbImageFileReaderTestSensorPixelValue.cxx @@ -60,7 +60,7 @@ int otbImageFileReaderTestSensorPixelValue(int argc, char* argv[]) reader->SetFileName(inputFilename); reader->UpdateOutputInformation(); - ConfigFile * pixelValuesConfig; + ConfigFile * pixelValuesConfig = NULL; try { @@ -125,6 +125,13 @@ int otbImageFileReaderTestSensorPixelValue(int argc, char* argv[]) double epsilon = 0.0000000001; double error = vcl_abs(imagePixelValue - baselinePixelValue); + + if(pixelValuesConfig != NULL) + { + delete pixelValuesConfig; + pixelValuesConfig = NULL; + } + if (error < epsilon) { return EXIT_SUCCESS; -- GitLab