Remove if(ptr) XFREE(ptr)

This commit is contained in:
Andras Fekete
2024-08-05 17:47:52 -04:00
parent 54370cc51e
commit a0b2da98e6
3 changed files with 11 additions and 24 deletions

View File

@ -3533,10 +3533,8 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
size = wolfSSL_get_server_random(ssl, rnd, size);
if (size == 0) {
if (rnd) {
XFREE(rnd, NULL, DYNAMIC_TYPE_TMP_BUFFER);
rnd = NULL;
}
XFREE(rnd, NULL, DYNAMIC_TYPE_TMP_BUFFER);
rnd = NULL;
err_sys_ex(runWithErrors, "error getting server random buffer");
}

View File

@ -2451,14 +2451,10 @@ static int aes_xts_128_test(void)
test_xts_end:
if (enc2)
XFREE(enc2, NULL, DYNAMIC_TYPE_AES);
if (dec2)
XFREE(dec2, NULL, DYNAMIC_TYPE_AES);
if (src)
XFREE(src, NULL, DYNAMIC_TYPE_AES);
if (dst)
XFREE(dst, NULL, DYNAMIC_TYPE_AES);
XFREE(enc2, NULL, DYNAMIC_TYPE_AES);
XFREE(dec2, NULL, DYNAMIC_TYPE_AES);
XFREE(src, NULL, DYNAMIC_TYPE_AES);
XFREE(dst, NULL, DYNAMIC_TYPE_AES);
if (req)
skcipher_request_free(req);
if (tfm)
@ -2466,19 +2462,14 @@ static int aes_xts_128_test(void)
out:
if (large_input)
XFREE(large_input, NULL, DYNAMIC_TYPE_TMP_BUFFER);
XFREE(large_input, NULL, DYNAMIC_TYPE_TMP_BUFFER);
if (aes_inited)
wc_AesXtsFree(aes);
if (buf)
XFREE(buf, NULL, DYNAMIC_TYPE_AES);
if (cipher)
XFREE(cipher, NULL, DYNAMIC_TYPE_AES);
if (aes)
XFREE(aes, NULL, DYNAMIC_TYPE_AES);
XFREE(buf, NULL, DYNAMIC_TYPE_AES);
XFREE(cipher, NULL, DYNAMIC_TYPE_AES);
XFREE(aes, NULL, DYNAMIC_TYPE_AES);
#undef AES_XTS_128_TEST_BUF_SIZ

View File

@ -146,9 +146,7 @@ error:
wolfSSL_TXT_DB_free(ret);
ret = NULL;
}
if (buf) {
XFREE(buf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
}
XFREE(buf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
return ret;
}