#986264 db.c: add information for the compiler to make analyzing execution paths easier

Package:
src:nn
Source:
nn
Submitter:
Bjarni Ingi Gislason
Date:
2021-04-02 02:57:14 UTC
Severity:
normal
Tags:
#986264#5
Date:
2021-04-02 02:52:23 UTC
From:
To:
Dear Maintainer,

  The compiler option "-fanalyzer" shows:

db.c:1239:12: warning: leak of '<unknown>' [CWE-401] [-Wanalyzer-malloc-leak]
 1239 |     grplist[count] = NULL;
      |            ^
...
           | 1151 |     if (actfp == NULL) {
           |      |        ~
           |      |        |
           |      |        (10) following 'true' branch (when 'actfp' is NULL)...
           | 1152 |  nn_exitmsg(1, "could not open .newsrc file %s\n", newsrc_file);
           |      |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           |      |  |
           |      |  (11) ...to here
           |......
           | 1165 |     if (nntp_debug) {

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
---
 db.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/db.c b/db.c
index 90221d0..c55fa3f 100644
--- a/db.c
+++ b/db.c
@@ -1216,6 +1216,9 @@ readpartactfile(void)
     if (grplist == NULL) {
 	nn_exitmsg(1, "can't create active or group list (%d entries)\n",
 		   count + 1);
+/* Give the compiler the information that the program exits with the
+   previous command */
+	exit(1);
     }

     /*