wpa_supplicant: Fix some memory leak issues by coverity static analyzer.

This commit is contained in:
aditi_lonkar
2021-03-23 11:09:52 +05:30
parent 98d19efe6f
commit c9f2790474
2 changed files with 7 additions and 4 deletions

View File

@@ -667,7 +667,7 @@ static int sae_derive_commit_element_ffc(struct sae_data *sae,
static int sae_derive_commit(struct sae_data *sae) static int sae_derive_commit(struct sae_data *sae)
{ {
struct crypto_bignum *mask; struct crypto_bignum *mask = NULL;
int ret = -1; int ret = -1;
unsigned int counter = 0; unsigned int counter = 0;
@@ -682,7 +682,9 @@ static int sae_derive_commit(struct sae_data *sae)
*/ */
return ESP_FAIL; return ESP_FAIL;
} }
if (mask) {
crypto_bignum_deinit(mask, 1);
}
mask = sae_get_rand_and_mask(sae); mask = sae_get_rand_and_mask(sae);
if (mask == NULL) { if (mask == NULL) {
wpa_printf(MSG_DEBUG, "SAE: Could not get rand/mask"); wpa_printf(MSG_DEBUG, "SAE: Could not get rand/mask");

View File

@@ -749,8 +749,9 @@ static int eap_peer_sm_init(void)
s_wpa2_data_lock = xSemaphoreCreateRecursiveMutex(); s_wpa2_data_lock = xSemaphoreCreateRecursiveMutex();
if (!s_wpa2_data_lock) { if (!s_wpa2_data_lock) {
wpa_printf(MSG_ERROR, "wpa2 eap_peer_sm_init: failed to alloc data lock"); // NOLINT(clang-analyzer-unix.Malloc) free(sm);
return ESP_ERR_NO_MEM; wpa_printf(MSG_ERROR, "wpa2 eap_peer_sm_init: failed to alloc data lock");
return ESP_ERR_NO_MEM;
} }
wpa2_set_eap_state(WPA2_ENT_EAP_STATE_NOT_START); wpa2_set_eap_state(WPA2_ENT_EAP_STATE_NOT_START);