fix potential null pointer dereference found by Coverity
CID 355460 of 1): Dereference before null check (REVERSE_INULL)check_after_deref: Null-checking p suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
737                if (p == NULL)
738                {
739                        return false;
740                }
@@ -721,6 +721,12 @@ bool PPPProcessRetransmissions(PPP_SESSION *p)
// Send the PPP Echo Request
bool PPPSendEchoRequest(PPP_SESSION *p)
{
+ // Validate arguments
+ if (p == NULL)
+ {
+ return false;
+ }
+
UINT64 now = Tick64();
if (p->NextEchoSendTime == 0 || now >= p->NextEchoSendTime)
{
@@ -733,12 +739,6 @@ bool PPPSendEchoRequest(PPP_SESSION *p)
AddInterrupt(p->Ipc->Interrupt, p->NextEchoSendTime);
}
- // Validate arguments
- if (p == NULL)
- {
- return false;
- }
-
pp = ZeroMalloc(sizeof(PPP_PACKET));
pp->Protocol = PPP_PROTOCOL_LCP;
pp->IsControl = true;
