Closed Bug 337085 Opened 15 years ago Closed 15 years ago

Coverity 447, dead code in mozilla/security/nss/lib/certhigh/ocsp.c

Categories

(NSS :: Libraries, defect, P3)

3.11
defect

Tracking

(Not tracked)

RESOLVED FIXED
3.11.2

People

(Reporter: jonsmirl, Assigned: alvolkov.bgs)

Details

(Keywords: coverity, Whiteboard: [CID 447 844])

Attachments

(1 file)

This one is a buglet, strdup can fail and the result wasn't checked.

diff -u -r1.21.2.3 ocsp.c
--- security/nss/lib/certhigh/ocsp.c    3 Apr 2006 20:15:40 -0000       1.21.2.3
+++ security/nss/lib/certhigh/ocsp.c    8 May 2006 04:33:28 -0000
@@ -1755,6 +1755,8 @@
        path[len] = '\0';
     } else {
        path = PORT_Strdup("/");
+       if (path == NULL)
+           goto loser;
     }

     *pHostname = hostname;
@@ -1765,8 +1767,6 @@
 loser:
     if (hostname != NULL)
        PORT_Free(hostname);
-    if (path != NULL)
-       PORT_Free(path);
     PORT_SetError(SEC_ERROR_CERT_BAD_ACCESS_LOCATION);
     return SECFailure;
 }
Severity: normal → trivial
Priority: -- → P3
Attachment #221264 - Flags: review?(wtchang)
Attachment #221264 - Flags: review?(wtchang) → review+
trunk
/cvsroot/mozilla/security/nss/lib/certhigh/ocsp.c,v  <--  ocsp.c
new revision: 1.24; previous revision: 1.23

3.11 branch
/cvsroot/mozilla/security/nss/lib/certhigh/ocsp.c,v  <--  ocsp.c
new revision: 1.21.2.5; previous revision: 1.21.2.4
Assignee: nobody → alexei.volkov.bugs
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Whiteboard: [CID 447]
Also CID 844
Whiteboard: [CID 447] → [CID 447 844]
You need to log in before you can comment on or make changes to this bug.