Mercurial > hg > freeDiameter
changeset 564:603f70bf1453
Cleanly destroy Diameter message when an Accounting Response is not generated in gateway
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Fri, 17 Sep 2010 17:23:46 +0900 |
parents | dc9764591567 |
children | 64e55fc10ab3 |
files | extensions/app_radgw/rgwx_acct.c |
diffstat | 1 files changed, 11 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/extensions/app_radgw/rgwx_acct.c Thu Sep 16 16:41:44 2010 +0900 +++ b/extensions/app_radgw/rgwx_acct.c Fri Sep 17 17:23:46 2010 +0900 @@ -1224,7 +1224,7 @@ static int acct_diam_ans( struct rgwp_config * cs, struct session * session, struct msg ** diam_ans, struct radius_msg ** rad_fw, struct rgw_client * cli, int * stateful ) { - struct sess_state * st = NULL; + struct sess_state * st = NULL, stloc; struct avp *avp, *next; struct avp_hdr *ahdr, *sid, *oh, *or; @@ -1240,6 +1240,11 @@ return EINVAL; } + /* Free the state */ + memcpy(&stloc, st, sizeof(struct sess_state)); + free(st); + st = &stloc; + /* Search these AVPs first */ CHECK_FCT( fd_msg_search_avp (*diam_ans, cs->dict.Session_Id, &avp) ); CHECK_FCT( fd_msg_avp_hdr ( avp, &sid ) ); @@ -1282,6 +1287,11 @@ fd_log_debug("[acct.rgwx] Failed-AVP was included in the message.\n"); /* Dump its content ? */ } + + /* Now, destroy the Diameter message, since we know it is not converted to RADIUS */ + CHECK_FCT( fd_msg_free(*diam_ans) ); + *diam_ans = NULL; + return -1; } /* Remove this Result-Code avp */ @@ -1425,8 +1435,6 @@ -- done in radius_msg_finish_srv */ - free(st); - return 0; }