1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

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
This commit is contained in:
Slava Semushin 2009-07-18 16:28:53 +07:00 committed by Jelmer Vernooij
parent a817cff5a0
commit 5f8df16471

View File

@ -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);