chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e3496f5
)
[PATCH] fix handle leak in udev_lib.c
author
fork0@users.sf.net
<fork0@users.sf.net>
Tue, 8 Jun 2004 23:47:16 +0000
(16:47 -0700)
committer
Greg KH
<gregkh@suse.de>
Wed, 27 Apr 2005 04:35:47 +0000
(21:35 -0700)
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.
udev_lib.c
patch
|
blob
|
history
diff --git
a/udev_lib.c
b/udev_lib.c
index 16b473f57608058177702f46b162faeb13f7bf99..8f6aa4237734a906c609484c0b8e6626cc7ecbc8 100644
(file)
--- 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;