Преглед изворни кода

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

aditi_lonkar пре 5 година
родитељ
комит
903f7bb99f

+ 4 - 2
components/wpa_supplicant/src/common/sae.c

@@ -675,7 +675,7 @@ static int sae_derive_commit_element_ffc(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;
 	unsigned int counter = 0;
 
@@ -690,7 +690,9 @@ static int sae_derive_commit(struct sae_data *sae)
 			 */
 			return ESP_FAIL;
 		}
-
+		if (mask) {
+		    crypto_bignum_deinit(mask, 1);
+		}
 		mask = sae_get_rand_and_mask(sae);
 		if (mask == NULL) {
 			wpa_printf(MSG_DEBUG, "SAE: Could not get rand/mask");

+ 1 - 0
components/wpa_supplicant/src/esp_supplicant/esp_wpa2.c

@@ -748,6 +748,7 @@ static int eap_peer_sm_init(void)
 
     s_wpa2_data_lock = xSemaphoreCreateRecursiveMutex();
     if (!s_wpa2_data_lock) {
+	free(sm);
         wpa_printf(MSG_ERROR, "wpa2 eap_peer_sm_init: failed to alloc data lock");
         return ESP_ERR_NO_MEM;
     }