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>
This commit is contained in:
parent
675c036fff
commit
e52a698907
1 changed files with 3 additions and 1 deletions
|
@ -1199,8 +1199,10 @@ int radius_msg_add_mppe_keys(struct radius_msg *msg,
|
||||||
vhdr = (struct radius_attr_vendor *) pos;
|
vhdr = (struct radius_attr_vendor *) pos;
|
||||||
vhdr->vendor_type = RADIUS_VENDOR_ATTR_MS_MPPE_SEND_KEY;
|
vhdr->vendor_type = RADIUS_VENDOR_ATTR_MS_MPPE_SEND_KEY;
|
||||||
pos = (u8 *) (vhdr + 1);
|
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;
|
return 0;
|
||||||
|
}
|
||||||
salt |= 0x8000;
|
salt |= 0x8000;
|
||||||
WPA_PUT_BE16(pos, salt);
|
WPA_PUT_BE16(pos, salt);
|
||||||
pos += 2;
|
pos += 2;
|
||||||
|
|
Loading…
Reference in a new issue