summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--udev_lib.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/udev_lib.c b/udev_lib.c
index 16b473f576..8f6aa42377 100644
--- a/udev_lib.c
+++ b/udev_lib.c
@@ -124,11 +124,13 @@ int file_map(const char *filename, char **buf, size_t *bufsize)
}
if (fstat(fd, &stats) < 0) {
+ close(fd);
return -1;
}
*buf = mmap(NULL, stats.st_size, PROT_READ, MAP_SHARED, fd, 0);
if (*buf == MAP_FAILED) {
+ close(fd);
return -1;
}
*bufsize = stats.st_size;