don't leak file descriptor when error during write
This commit is contained in:
parent
812ba038a6
commit
3d59b4e965
|
@ -39,6 +39,7 @@ int write_data(const char *filename, const uint8_t *data, size_t length)
|
|||
|
||||
if (write(outfd, data, length) < 0) {
|
||||
perror(filename);
|
||||
close(outfd);
|
||||
return 0;
|
||||
}
|
||||
close(outfd);
|
||||
|
|
Loading…
Reference in New Issue