if (security_type == WIFI_SECURITY_TYPE_EAP) {
h->eap_config = g_new0(struct _wifi_eap_config, 1);
- if (h->eap_config == NULL)
+ if (h->eap_config == NULL) {
+ g_free(h->name);
+ g_free(h->passphrase);
+ g_free(h);
return WIFI_ERROR_OUT_OF_MEMORY;
+ }
h->eap_config->ca_cert = NULL;
h->eap_config->client_cert = NULL;
if (config->eap_config) {
h->eap_config = g_new0(struct _wifi_eap_config, 1);
- if (h->eap_config == NULL)
+ if (h->eap_config == NULL) {
+ g_free(h->name);
+ g_free(h->passphrase);
+ g_free(h->proxy_address);
+ g_free(h);
return WIFI_ERROR_OUT_OF_MEMORY;
+ }
h->eap_config->ca_cert = g_strdup(config->eap_config->ca_cert);
h->eap_config->client_cert = g_strdup(config->eap_config->client_cert);
g_free(h->eap_config);
}
g_free(h);
+ h = NULL;
if (rv == false)
break;