commit | b3493a7aadd6f36b98075af7ac8bd9e276b4b361 | [log] [tgz] |
---|---|---|
author | Jens Axboe <axboe@fb.com> | Mon Apr 14 13:20:38 2014 -0600 |
committer | Jens Axboe <axboe@fb.com> | Mon Apr 14 13:20:38 2014 -0600 |
tree | d7763188212627663dff7023d8105d840c7314d6 | |
parent | 9edf7b3ed581a61433ad620d457b4d0349115e52 [diff] [blame] |
Fix potential NULL dereference in alloc_mem_mmap() Signed-off-by: Jens Axboe <axboe@fb.com>
diff --git a/memory.c b/memory.c index b208320..8c06d94 100644 --- a/memory.c +++ b/memory.c
@@ -158,9 +158,10 @@ if (td->orig_buffer == MAP_FAILED) { td_verror(td, errno, "mmap"); td->orig_buffer = NULL; - if (td->mmapfd) { + if (td->mmapfd != 1) { close(td->mmapfd); - unlink(td->o.mmapfile); + if (td->o.mmapfile) + unlink(td->o.mmapfile); } return 1;