git.samba.org
/
abartlet
/
samba.git
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a817cff
)
lib/util/util_file.c(file_save): fixed file descriptor leak when read(2) fails.
author
Slava Semushin
<php-coder@altlinux.ru>
Sat, 18 Jul 2009 09:28:53 +0000
(16:28 +0700)
committer
Jelmer Vernooij
<jelmer@samba.org>
Sun, 19 Jul 2009 14:00:39 +0000
(16:00 +0200)
Found by cppcheck:
[./lib/util/util_file.c:383]: (error) Resource leak: fd
lib/util/util_file.c
patch
|
blob
|
history
diff --git
a/lib/util/util_file.c
b/lib/util/util_file.c
index 0275e78c54fc89f3a69d2539c82874ea1ce10878..7466004e5ce07f175608202d797d23d94f2f2274 100644
(file)
--- a/
lib/util/util_file.c
+++ b/
lib/util/util_file.c
@@
-380,6
+380,7
@@
_PUBLIC_ bool file_save(const char *fname, const void *packet, size_t length)
return false;
}
if (write(fd, packet, length) != (size_t)length) {
+ close(fd);
return false;
}
close(fd);