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:
parent
a817cff5a0
commit
5f8df16471
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user