Source: nn
Version: 6.7.3-14
Severity: normal
Tags: patch

Dear Maintainer,

>From 70ac18c4ec83348259c613d1801e24b50731fcc6 Mon Sep 17 00:00:00 2001
>From: Bjarni Ingi Gislason <bjarn...@rhi.hi.is>
>Date: Sat, 3 Apr 2021 23:43:04 +0000
>Subject: [PATCH] db.c: always close file pointer "actfp"

  File pointer "actfp" is opened independent of the use of NNTP or not
("use_nntp").

  Should silence a warning:

db.c:1252:12: warning: leak of FILE 'actfp' [CWE-775] [-Wanalyzer-file-leak]
 1252 |     grplist[count] = NULL;
      |            ^
...
           | 1251 |     actlist[count] = NULL;
           | 1252 |     grplist[count] = NULL;
           |      |            ~
           |      |            |
           |      |            (26) 'actfp' leaks here; was opened at (10)

Signed-off-by: Bjarni Ingi Gislason <bjarn...@rhi.hi.is>
---
 db.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/db.c b/db.c
index 15a9372..bd10cc4 100644
--- a/db.c
+++ b/db.c
@@ -1092,8 +1092,7 @@ readactfile(void)
     }
     stp->n.next = NULL;
 
-    if (!use_nntp)
-       (void) fclose(actfp);
+    (void) fclose(actfp);
 
     actlist = (char **) calloc(count + 1, sizeof(char *));
     grplist = (char **) calloc(count + 1, sizeof(char *));
@@ -1218,8 +1217,7 @@ readpartactfile(void)
     }
     stp->n.next = NULL;
 
-    if (!use_nntp)
-       (void) fclose(actfp);
+    (void) fclose(actfp);
 
     actlist = (char **) calloc(count + 1, sizeof(char *));
     grplist = (char **) calloc(count + 1, sizeof(char *));
-- 
2.30.2



-- System Information:
Debian Release: bullseye/sid
  APT prefers testing-security
  APT policy: (500, 'testing-security'), (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.24-1 (SMP w/2 CPU threads)
Locale: LANG=is_IS.iso88591, LC_CTYPE=is_IS.iso88591 (charmap=ISO-8859-1), 
LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

-- debconf information excluded

-- 
Bjarni I. Gislason

Reply via email to