[mod_avmd] Coverity CID 1395501 (Dereference null return value)

This commit is contained in:
Jakub Karolczyk 2023-04-14 11:55:09 +01:00
parent 639dab4edf
commit d91bc3906f
1 changed files with 6 additions and 0 deletions

View File

@ -112,6 +112,10 @@ extern int compute_table(void)
acos_table_file = fopen(ACOS_TABLE_FILENAME, "w");
if (!acos_table_file) {
return -3;
}
for (i = 0; i < ACOS_TABLE_LENGTH; i++) {
f = acosf(float_from_index(i));
res = fwrite(&f, sizeof(f), 1, acos_table_file);
@ -124,10 +128,12 @@ extern int compute_table(void)
if (res != 0) {
return -2;
}
return 0;
fail:
fclose(acos_table_file);
return -1;
}