1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +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; return false;
} }
if (write(fd, packet, length) != (size_t)length) { if (write(fd, packet, length) != (size_t)length) {
close(fd);
return false; return false;
} }
close(fd); close(fd);