1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-22 17:39:53 +03:00

Merge pull request #275 from chipitsine/master

cppcheck findings
This commit is contained in:
Moataz Elmasry 2018-02-01 00:06:08 +01:00 committed by GitHub
commit a5fa265811
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 11 deletions

View File

@ -410,11 +410,12 @@ PACK *AdminDispatch(RPC *rpc, char *name, PACK *p)
server = a->Server;
if (server != NULL)
if (server == NULL)
{
cedar = server->Cedar;
return NULL;
}
cedar = server->Cedar;
Lock(cedar->CedarSuperLock);
if (true)

View File

@ -6652,7 +6652,10 @@ SOCK *SocksConnectEx2(CONNECTION *c, char *proxy_host_name, UINT proxy_port,
if (c == NULL || proxy_host_name == NULL || proxy_port == 0 || server_host_name == NULL
|| server_port == 0)
{
c->Err = ERR_PROXY_CONNECT_FAILED;
if (c != NULL)
{
c->Err = ERR_PROXY_CONNECT_FAILED;
}
return NULL;
}
@ -6846,7 +6849,10 @@ SOCK *ProxyConnectEx2(CONNECTION *c, char *proxy_host_name, UINT proxy_port,
if (c == NULL || proxy_host_name == NULL || proxy_port == 0 || server_host_name == NULL ||
server_port == 0)
{
c->Err = ERR_PROXY_CONNECT_FAILED;
if( c != NULL)
{
c->Err = ERR_PROXY_CONNECT_FAILED;
}
return NULL;
}
if (username != NULL && password != NULL &&

View File

@ -326,7 +326,7 @@ static wchar_t *WpListener(WEBUI *wu, LIST *params)
WU_CONTEXT *context = WuGetContext(wu->Contexts, sessionkey);
char *cmd = (char*)StrMapSearch(params, "CMD");
RPC_LISTENER t;
UINT retcode;
UINT retcode = ERR_NO_ERROR;
if(context == NULL)
{

View File

@ -2338,6 +2338,11 @@ void CfgDeleteFolder(FOLDER *f)
return;
}
if(f->Folders == NULL)
{
return;
}
// Remove all subfolders
num = LIST_NUM(f->Folders);
ff = Malloc(sizeof(FOLDER *) * num);

View File

@ -4424,7 +4424,7 @@ void DesEcbEncrypt(void *dst, void *src, void *key_7bytes)
DES_cblock key;
DES_key_schedule ks;
// Validate arguments
if (dst == NULL || src == NULL || key == NULL)
if (dst == NULL || src == NULL || key_7bytes == NULL)
{
return;
}

View File

@ -2038,7 +2038,7 @@ UINT Utf8ToUni(wchar_t *s, UINT size, BYTE *u, UINT u_size)
while (true)
{
UINT type;
wchar_t c;
wchar_t c = 0;
BYTE c1, c2;
type = GetUtf8Type(u, u_size, i);
@ -2063,8 +2063,6 @@ UINT Utf8ToUni(wchar_t *s, UINT size, BYTE *u, UINT u_size)
}
i += type;
c = 0;
if (IsBigEndian())
{
if (sizeof(wchar_t) == 2)

View File

@ -2659,7 +2659,7 @@ void RUDPBulkSend(RUDP_STACK *r, RUDP_SESSION *se, void *data, UINT data_size)
CRYPT *c;
UCHAR crypt_key_src[SHA1_SIZE * 2];
UCHAR crypt_key[SHA1_SIZE];
UINT icmp_type;
UINT icmp_type = 0;
UCHAR sign[SHA1_SIZE];
UCHAR iv[SHA1_SIZE + 1];
// Validate arguments
@ -13512,7 +13512,7 @@ UINT SecureRecv(SOCK *sock, void *data, UINT size)
UINT SecureSend(SOCK *sock, void *data, UINT size)
{
SOCKET s;
int ret, e;
int ret, e = SSL_ERROR_NONE;
SSL *ssl;
s = sock->socket;
ssl = sock->ssl;