forked from wolfSSL/wolfssl
Fixes for scan-build warnings. Fix possible memory leak in wolfSSL_DH_new on failure. Add null checks in integer.c for destination to make sure “dp” grows when NULL (even though never happens in real-use). Added suppression of wc_port.c warning “Value stored to 'ret' is never read”.
This commit is contained in:
@ -16133,6 +16133,7 @@ WOLFSSL_DH* wolfSSL_DH_new(void)
|
|||||||
if (wc_InitDhKey(key) != 0) {
|
if (wc_InitDhKey(key) != 0) {
|
||||||
WOLFSSL_MSG("wolfSSL_DH_new InitDhKey failure");
|
WOLFSSL_MSG("wolfSSL_DH_new InitDhKey failure");
|
||||||
XFREE(key, NULL, DYNAMIC_TYPE_DH);
|
XFREE(key, NULL, DYNAMIC_TYPE_DH);
|
||||||
|
XFREE(external, NULL, DYNAMIC_TYPE_DH);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
external->internal = key;
|
external->internal = key;
|
||||||
|
@ -330,7 +330,7 @@ int mp_copy (mp_int * a, mp_int * b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* grow dest */
|
/* grow dest */
|
||||||
if (b->alloc < a->used) {
|
if (b->alloc < a->used || b->dp == NULL) {
|
||||||
if ((res = mp_grow (b, a->used)) != MP_OKAY) {
|
if ((res = mp_grow (b, a->used)) != MP_OKAY) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -1633,7 +1633,7 @@ int s_mp_sub (mp_int * a, mp_int * b, mp_int * c)
|
|||||||
max_a = a->used;
|
max_a = a->used;
|
||||||
|
|
||||||
/* init result */
|
/* init result */
|
||||||
if (c->alloc < max_a) {
|
if (c->alloc < max_a || c->dp == NULL) {
|
||||||
if ((res = mp_grow (c, max_a)) != MP_OKAY) {
|
if ((res = mp_grow (c, max_a)) != MP_OKAY) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -78,6 +78,7 @@ int wolfCrypt_Init(void)
|
|||||||
WOLFSSL_MSG(ippGetStatusString(ret));
|
WOLFSSL_MSG(ippGetStatusString(ret));
|
||||||
WOLFSSL_MSG("Using default fast IPP library");
|
WOLFSSL_MSG("Using default fast IPP library");
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
(void)ret; /* suppress not read warning */
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user