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