Merge pull request #765 from dgarske/scanbuild_fixes

Fixes for scan-build warnings
This commit is contained in:
toddouska
2017-03-03 15:58:10 -08:00
committed by GitHub
3 changed files with 10 additions and 3 deletions

View File

@ -16137,6 +16137,7 @@ WOLFSSL_DH* wolfSSL_DH_new(void)
if (wc_InitDhKey(key) != 0) {
WOLFSSL_MSG("wolfSSL_DH_new InitDhKey failure");
XFREE(key, NULL, DYNAMIC_TYPE_DH);
XFREE(external, NULL, DYNAMIC_TYPE_DH);
return NULL;
}
external->internal = key;

View File

@ -354,7 +354,7 @@ int mp_copy (mp_int * a, mp_int * b)
}
/* clear high digits */
for (; n < b->used; n++) {
for (; n < b->used && b->dp; n++) {
*tmpb++ = 0;
}
}
@ -1638,6 +1638,11 @@ int s_mp_sub (mp_int * a, mp_int * b, mp_int * c)
return res;
}
}
/* sanity check on destination */
if (c->dp == NULL)
return MP_VAL;
olduse = c->used;
c->used = max_a;
@ -3767,7 +3772,7 @@ int s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
pa = a->used;
pb = b->used;
for (ix = 0; ix < pa; ix++) {
for (ix = 0; ix < pa && a->dp; ix++) {
/* clear the carry */
u = 0;
@ -3840,7 +3845,7 @@ int fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
/* number of output digits to produce */
pa = a->used + b->used;
_W = 0;
for (ix = digs; ix < pa; ix++) {
for (ix = digs; ix < pa && a->dp; ix++) {
int tx, ty, iy;
mp_digit *tmpx, *tmpy;

View File

@ -78,6 +78,7 @@ int wolfCrypt_Init(void)
WOLFSSL_MSG(ippGetStatusString(ret));
WOLFSSL_MSG("Using default fast IPP library");
ret = 0;
(void)ret; /* suppress not read warning */
}
#endif