diff options
author | Slava Semushin <php-coder@altlinux.ru> | 2009-07-18 16:28:53 +0700 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2009-07-19 16:00:39 +0200 |
commit | 5f8df164716a43bd9e6c22dfd1f066bf96ccf273 (patch) | |
tree | 97a1f7c1c2bff24964e4bb4e89d52aa7412a8fdc /lib | |
parent | a817cff5a0f17c6a8b35013483a18c70acdfaa1c (diff) | |
download | samba-5f8df164716a43bd9e6c22dfd1f066bf96ccf273.tar.gz samba-5f8df164716a43bd9e6c22dfd1f066bf96ccf273.tar.bz2 samba-5f8df164716a43bd9e6c22dfd1f066bf96ccf273.zip |
lib/util/util_file.c(file_save): fixed file descriptor leak when read(2) fails.
Found by cppcheck:
[./lib/util/util_file.c:383]: (error) Resource leak: fd
Diffstat (limited to 'lib')
-rw-r--r-- | lib/util/util_file.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/util/util_file.c b/lib/util/util_file.c index 0275e78c54..7466004e5c 100644 --- 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); |