aboutsummaryrefslogtreecommitdiffstats
path: root/src/eap_peer/eap_fast_pac.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2008-11-01 15:09:28 (GMT)
committerJouni Malinen <j@w1.fi>2008-11-01 15:09:28 (GMT)
commitac987fb7de1d6336cd7b8b9106a133b214ea59ed (patch)
tree5c62abb429431f6452e9512e8073c823cc596d77 /src/eap_peer/eap_fast_pac.c
parent8caa12b46c7a1c65fad123b754c449903bc7dea9 (diff)
downloadhostap-ac987fb7de1d6336cd7b8b9106a133b214ea59ed.zip
hostap-ac987fb7de1d6336cd7b8b9106a133b214ea59ed.tar.gz
hostap-ac987fb7de1d6336cd7b8b9106a133b214ea59ed.tar.bz2
Fixed fwrite error path in eap_fast_write_pac not to free buf
Caller expects the buffer to be allocated on error, so eap_fast_write_pac() must be consistent with its behavior on error paths.
Diffstat (limited to 'src/eap_peer/eap_fast_pac.c')
-rw-r--r--src/eap_peer/eap_fast_pac.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/eap_peer/eap_fast_pac.c b/src/eap_peer/eap_fast_pac.c
index 0f5ef81..77893d6 100644
--- a/src/eap_peer/eap_fast_pac.c
+++ b/src/eap_peer/eap_fast_pac.c
@@ -533,8 +533,6 @@ static void eap_fast_write(char **buf, char **pos, size_t *buf_len,
static int eap_fast_write_pac(struct eap_sm *sm, const char *pac_file,
char *buf, size_t len)
{
- int ret = 0;
-
if (os_strncmp(pac_file, "blob://", 7) == 0) {
struct wpa_config_blob *blob;
blob = os_zalloc(sizeof(*blob));
@@ -560,13 +558,14 @@ static int eap_fast_write_pac(struct eap_sm *sm, const char *pac_file,
if (fwrite(buf, 1, len, f) != len) {
wpa_printf(MSG_INFO, "EAP-FAST: Failed to write all "
"PACs into '%s'", pac_file);
- ret = -1;
+ fclose(f);
+ return -1;
}
os_free(buf);
fclose(f);
}
- return ret;
+ return 0;
}