ffbuild/bin2c: misc fix
close input file if open output fail/read errors. Signed-off-by: Alexander Strasser <eclipse7@gmx.net> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
This commit is contained in:
parent
851a84650e
commit
8ded602eda
1 changed files with 6 additions and 2 deletions
|
|
@ -38,8 +38,10 @@ int main(int argc, char **argv)
|
|||
return -1;
|
||||
|
||||
output = fopen(argv[2], "wb");
|
||||
if (!output)
|
||||
if (!output) {
|
||||
fclose(input);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (argc == 4) {
|
||||
name = argv[3];
|
||||
|
|
@ -67,8 +69,10 @@ int main(int argc, char **argv)
|
|||
|
||||
fclose(output);
|
||||
|
||||
if (ferror(input) || !feof(input))
|
||||
if (ferror(input) || !feof(input)) {
|
||||
fclose(input);
|
||||
return -1;
|
||||
}
|
||||
|
||||
fclose(input);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue