]> granicus.if.org Git - procps-ng/commitdiff
pmap: minor Coverity fix for -N option
authorCraig Small <csmall@dropbear.xyz>
Tue, 2 Nov 2021 06:14:29 +0000 (17:14 +1100)
committerCraig Small <csmall@dropbear.xyz>
Tue, 2 Nov 2021 06:14:29 +0000 (17:14 +1100)
99126 Explicit null dereferenced
Not 100% sure this is valid (the same branch that sets the variable
is the one that sets N_option) but not too hard to fix.

Signed-off-by: Craig Small <csmall@dropbear.xyz>
pmap.c

diff --git a/pmap.c b/pmap.c
index 042d9dc0e34e53fafddfa5005144b9d05af83adf..38b3629f3ee1c1ea06724d179b5f24ed9ec210ee 100644 (file)
--- a/pmap.c
+++ b/pmap.c
@@ -909,10 +909,13 @@ static int config_read (char *rc_filename)
 }
 
 
-static int config_create (char *rc_filename)
+static int config_create (const char *rc_filename)
 {
        FILE *f;
 
+       if (rc_filename == NULL)
+               return 0;
+
        /* check if rc exists */
        f = fopen(rc_filename, "r");