Closing an open file descriptor in MemoryMapFile.
authorTim King <taking@google.com>
Mon, 26 Sep 2016 04:03:39 +0000 (21:03 -0700)
committerTim King <taking@google.com>
Mon, 26 Sep 2016 04:03:39 +0000 (21:03 -0700)
src/parser/memory_mapped_input_buffer.cpp

index c9515aa92c33a9a39882920669916da87cd51fed..1554428f7288a822fa6ff28e32e3a5b67f499793 100644 (file)
@@ -110,6 +110,7 @@ static ANTLR3_UINT32 MemoryMapFile(pANTLR3_INPUT_STREAM input,
 
   input->data = mmap(0, input->sizeBuf, PROT_READ, MAP_PRIVATE, fd, 0);
   errno = 0;
+  close(fd);
   if(intptr_t(input->data) == -1) {
     return ANTLR3_ERR_NOMEM;
   }