mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-05 09:17:44 +03:00
[PATCH] fix handle leak in udev_lib.c
There is a handle leak in failure path in file_map, and the result of file_map (or the result of the caller of the file_map) is not always checked.
This commit is contained in:
parent
e3496f5932
commit
686cecf242
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user