diff --git a/Testing/Code/IO/otbImageFileReaderTestSensorPixelValue.cxx b/Testing/Code/IO/otbImageFileReaderTestSensorPixelValue.cxx
index ae2a6fc57f400db930a4cfbf07a0a7e835cba9fa..a28233126d119601f4be61ebfc12247ff9831bba 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;