Skip to content

Commit

Permalink
pcp: fix cppcheck warning
Browse files Browse the repository at this point in the history
src/pcp/request.c:115:13: warning: Possible null pointer dereference: msg [nullPointer]
 if (err || msg->hdr.result != PCP_SUCCESS ) {
            ^
src/pcp/request.c:141:29: note: Calling function 'completed', 3rd argument 'NULL' value is 0
  completed(req, ETIMEDOUT, NULL);
                            ^
src/pcp/request.c:115:13: note: Null pointer dereference
 if (err || msg->hdr.result != PCP_SUCCESS ) {
            ^
  • Loading branch information
alfredh authored and sreimers committed Sep 22, 2022
1 parent 3708104 commit 9409513
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/pcp/request.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ static void completed(struct pcp_request *req, int err, struct pcp_msg *msg)

/* if the request failed, we only called the
response handler once and never again */
if (err || msg->hdr.result != PCP_SUCCESS ) {
if (err || !msg || msg->hdr.result != PCP_SUCCESS ) {
req->resph = NULL;
}

Expand Down

0 comments on commit 9409513

Please sign in to comment.