aboutsummaryrefslogtreecommitdiffstats
path: root/src/radius
diff options
context:
space:
mode:
authorAyala Beker <ayala.beker@intel.com>2016-04-07 10:31:00 (GMT)
committerJouni Malinen <j@w1.fi>2016-04-08 08:40:20 (GMT)
commite52a6989073bdb6f6ba5cd74e4f37dbd4dbfd575 (patch)
tree89957df283fde9572758f0f696fbc48608ab3902 /src/radius
parent675c036fff6b6ada7eeee7545e4c989ef83e3ee0 (diff)
downloadhostap-e52a6989073bdb6f6ba5cd74e4f37dbd4dbfd575.zip
hostap-e52a6989073bdb6f6ba5cd74e4f37dbd4dbfd575.tar.gz
hostap-e52a6989073bdb6f6ba5cd74e4f37dbd4dbfd575.tar.bz2
RADIUS: Fix a possible memory leak on an error path
Fix a possible memory leak in radius_msg_add_mppe_keys() if os_get_random() fails. Signed-off-by: Ayala Beker <ayala.beker@intel.com>
Diffstat (limited to 'src/radius')
-rw-r--r--src/radius/radius.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/radius/radius.c b/src/radius/radius.c
index da978db..7bc6f74 100644
--- a/src/radius/radius.c
+++ b/src/radius/radius.c
@@ -1199,8 +1199,10 @@ int radius_msg_add_mppe_keys(struct radius_msg *msg,
vhdr = (struct radius_attr_vendor *) pos;
vhdr->vendor_type = RADIUS_VENDOR_ATTR_MS_MPPE_SEND_KEY;
pos = (u8 *) (vhdr + 1);
- if (os_get_random((u8 *) &salt, sizeof(salt)) < 0)
+ if (os_get_random((u8 *) &salt, sizeof(salt)) < 0) {
+ os_free(buf);
return 0;
+ }
salt |= 0x8000;
WPA_PUT_BE16(pos, salt);
pos += 2;