# HG changeset patch # User Sebastien Decugis # Date 1284711826 -32400 # Node ID 603f70bf1453ab0c11f835bad357f2252d93add3 # Parent dc97645915679fe27f10b8a87662e975f328f5a2 Cleanly destroy Diameter message when an Accounting Response is not generated in gateway diff -r dc9764591567 -r 603f70bf1453 extensions/app_radgw/rgwx_acct.c --- 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; }