diff --git a/io/io/src/TDirectoryFile.cxx b/io/io/src/TDirectoryFile.cxx
index afe869d5901f1e9aba997b8f462e1e0f39a1567f..52053424a63e6f2c5089117c6e23fd5312882222 100644
--- a/io/io/src/TDirectoryFile.cxx
+++ b/io/io/src/TDirectoryFile.cxx
@@ -1243,7 +1243,11 @@ Int_t TDirectoryFile::ReadKeys(Bool_t forceRead)
       char *header = new char[nbytes];
       buffer       = header;
       fFile->Seek(fSeekDir);
-      fFile->ReadBuffer(buffer,nbytes);
+      if ( fFile->ReadBuffer(buffer,nbytes) ) {
+         // ReadBuffer return kTRUE in case of failure.
+         delete [] header;
+         return 0;
+      }
       buffer += fNbytesName;
       Version_t versiondir;
       frombuf(buffer,&versiondir);