mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-22 17:39:53 +03:00
resolve several issues found by cppcheck (#483)
[src/Cedar/Connection.c:1090] -> [src/Cedar/Connection.c:1086]: (warning) Either the condition 's!=NULL' is redundant or there is possible null pointer dereference: s. macros IS_SEND_TCP_SOCK expands into "s" dereferencing, so check for NULL should go before that macros [src/Cedar/Protocol.c:2951] -> [src/Cedar/Protocol.c:2892]: (warning) Either the condition 'policy!=NULL' is redundant or there is possible null pointer dereference: policy. [src/Cedar/Protocol.c:2951] -> [src/Cedar/Protocol.c:2901]: (warning) Either the condition 'policy!=NULL' is redundant or there is possible null pointer dereference: policy. [src/Cedar/Protocol.c:3151] -> [src/Cedar/Protocol.c:3082]: (warning) Either the condition 'policy!=NULL' is redundant or there is possible null pointer dereference: policy. [src/Cedar/Protocol.c:3151] -> [src/Cedar/Protocol.c:3083]: (warning) Either the condition 'policy!=NULL' is redundant or there is possible null pointer dereference: policy. as we already have a check if (policy == NULL) { // Use the default policy policy = ClonePolicy(GetDefaultPolicy()); } no need to compare policy with NULL anymore
This commit is contained in:
parent
6cdeb69a86
commit
f5645fe3fd
@ -1082,12 +1082,12 @@ void ConnectionSend(CONNECTION *c, UINT64 now)
|
|||||||
for (i = 0;i < num;i++)
|
for (i = 0;i < num;i++)
|
||||||
{
|
{
|
||||||
TCPSOCK *tcpsock = tcpsocks[i];
|
TCPSOCK *tcpsock = tcpsocks[i];
|
||||||
if (tcpsock->Sock->Connected && tcpsock->Sock->AsyncMode &&
|
if (s != NULL && tcpsock->Sock->Connected && tcpsock->Sock->AsyncMode &&
|
||||||
IS_SEND_TCP_SOCK(tcpsock))
|
IS_SEND_TCP_SOCK(tcpsock))
|
||||||
{
|
{
|
||||||
// Processing of KeepAlive
|
// Processing of KeepAlive
|
||||||
if (now >= tcpsock->NextKeepAliveTime || tcpsock->NextKeepAliveTime == 0 ||
|
if (now >= tcpsock->NextKeepAliveTime || tcpsock->NextKeepAliveTime == 0 ||
|
||||||
(s != NULL && s->UseUdpAcceleration && s->UdpAccel != NULL && s->UdpAccel->MyPortByNatTServerChanged))
|
(s->UseUdpAcceleration && s->UdpAccel != NULL && s->UdpAccel->MyPortByNatTServerChanged))
|
||||||
{
|
{
|
||||||
// Send the KeepAlive
|
// Send the KeepAlive
|
||||||
SendKeepAlive(c, tcpsock);
|
SendKeepAlive(c, tcpsock);
|
||||||
|
@ -2948,12 +2948,9 @@ bool ServerAccept(CONNECTION *c)
|
|||||||
// VLAN ID
|
// VLAN ID
|
||||||
if (assigned_vlan_id != 0)
|
if (assigned_vlan_id != 0)
|
||||||
{
|
{
|
||||||
if (policy != NULL)
|
if (policy->VLanId == 0)
|
||||||
{
|
{
|
||||||
if (policy->VLanId == 0)
|
policy->VLanId = assigned_vlan_id;
|
||||||
{
|
|
||||||
policy->VLanId = assigned_vlan_id;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3146,12 +3143,7 @@ bool ServerAccept(CONNECTION *c)
|
|||||||
s->Timeout = timeout;
|
s->Timeout = timeout;
|
||||||
s->QoS = qos;
|
s->QoS = qos;
|
||||||
s->NoReconnectToSession = no_reconnect_to_session;
|
s->NoReconnectToSession = no_reconnect_to_session;
|
||||||
|
s->VLanId = policy->VLanId;
|
||||||
|
|
||||||
if (policy != NULL)
|
|
||||||
{
|
|
||||||
s->VLanId = policy->VLanId;
|
|
||||||
}
|
|
||||||
|
|
||||||
// User name
|
// User name
|
||||||
s->Username = CopyStr(username);
|
s->Username = CopyStr(username);
|
||||||
|
Loading…
Reference in New Issue
Block a user