don't leak file descriptor when error during write

This commit is contained in:
Mathias Panzenböck 2015-07-11 18:33:24 +02:00
parent 812ba038a6
commit 3d59b4e965
1 changed files with 1 additions and 0 deletions

View File

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