From d91bc3906f644e289560d7fcdb055e436d76b990 Mon Sep 17 00:00:00 2001 From: Jakub Karolczyk Date: Fri, 14 Apr 2023 11:55:09 +0100 Subject: [PATCH] [mod_avmd] Coverity CID 1395501 (Dereference null return value) --- src/mod/applications/mod_avmd/avmd_fast_acosf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mod/applications/mod_avmd/avmd_fast_acosf.c b/src/mod/applications/mod_avmd/avmd_fast_acosf.c index d7ca8683af..22a792f7d6 100644 --- a/src/mod/applications/mod_avmd/avmd_fast_acosf.c +++ b/src/mod/applications/mod_avmd/avmd_fast_acosf.c @@ -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; }