From 639dab4edf4210dfc30b4c4814c8a502696fb3f6 Mon Sep 17 00:00:00 2001 From: Jakub Karolczyk Date: Fri, 14 Apr 2023 11:40:41 +0100 Subject: [PATCH] [mod_avmd] Coverity CID 1395478 (Resource leak) --- src/mod/applications/mod_avmd/avmd_fast_acosf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_avmd/avmd_fast_acosf.c b/src/mod/applications/mod_avmd/avmd_fast_acosf.c index 572c6a84f9..d7ca8683af 100644 --- a/src/mod/applications/mod_avmd/avmd_fast_acosf.c +++ b/src/mod/applications/mod_avmd/avmd_fast_acosf.c @@ -144,8 +144,9 @@ extern int init_fast_acosf(void) * or some other error occured */ errsv = errno; strerror_r(errsv, err, 150); - if (errsv != ENOENT) return -1; - else { + if (errsv != ENOENT) { + return -1; + } else { switch_log_printf( SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, @@ -170,6 +171,7 @@ extern int init_fast_acosf(void) acos_table = (float *) mmap( NULL, /* kernel chooses the address at which to create the mapping */ ACOS_TABLE_LENGTH * sizeof(float), PROT_READ, MAP_SHARED, acos_fd, 0); + fclose(acos_fp); if (acos_table == MAP_FAILED) return -4; return 0;