r7030@Kushana: nickm | 2006-08-04 14:46:52 -0700

Close an fd leak on failed mmap()


svn:r6988
This commit is contained in:
Nick Mathewson 2006-08-05 17:53:32 +00:00
parent 7c596c166b
commit 1b7ad5aed3

View File

@ -134,6 +134,7 @@ tor_mmap_file(const char *filename)
string = mmap(0, size, PROT_READ, MAP_PRIVATE, fd, 0); string = mmap(0, size, PROT_READ, MAP_PRIVATE, fd, 0);
if (string == MAP_FAILED) { if (string == MAP_FAILED) {
close(fd);
log_warn(LD_FS,"Could not mmap file \"%s\": %s", filename, log_warn(LD_FS,"Could not mmap file \"%s\": %s", filename,
strerror(errno)); strerror(errno));
return NULL; return NULL;