# HG changeset patch # User Sebastien Decugis # Date 1245040501 -32400 # Node ID 2d1f1c6ae1cd66d31d2f282357a2a4fb75d6c58b # Parent 7b3d4431610ae50b19d0c9b37290bbc0bd04b2ba Simplified algo to delete the handled attributes diff -r 7b3d4431610a -r 2d1f1c6ae1cd extensions/radius_gw/sub_auth.c --- a/extensions/radius_gw/sub_auth.c Thu Jun 11 18:08:17 2009 +0900 +++ b/extensions/radius_gw/sub_auth.c Mon Jun 15 13:35:01 2009 +0900 @@ -100,7 +100,6 @@ int got_eap = 0; int got_empty_eap = 0; uint32_t status_type; - size_t *nattr_pos; size_t nattr_used = 0; dict_object_t * avp_tun_dict; msg_avp_t ** avp_tun = NULL; @@ -296,7 +295,6 @@ CHECK_FCT( dict_search( DICT_AVP, AVP_BY_NAME, "Tunneling", &avp_tun_dict, ENOENT)); /* Convert the attributes one by one */ - CHECK_MALLOC( nattr_pos = malloc(rad_req->attr_size * sizeof(size_t)) ); for (idx = 0; idx < rad_req->attr_used; idx++) { struct radius_attr_hdr * attr = (struct radius_attr_hdr *)(rad_req->buf + rad_req->attr_pos[idx]); dict_object_t * avp_dict; @@ -808,16 +806,14 @@ /* Default */ default: /* unknown attribute */ /* We just keep the attribute in the RADIUS message */ - nattr_pos[nattr_used++] = rad_req->attr_pos[idx]; + rad_req->attr_pos[nattr_used++] = rad_req->attr_pos[idx]; } } - /* Destroy tunnel pointers in case we used it */ + /* Destroy tunnel pointers (if we used it) */ free(avp_tun); /* Update the radius message to remove all handled attributes */ - free(rad_req->attr_pos); - rad_req->attr_pos = nattr_pos; rad_req->attr_used = nattr_used; return 0;