[asterisk-commits] mmichelson: branch mmichelson/pool_shark2 r381593 - /team/mmichelson/pool_sha...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Feb 15 17:16:43 CST 2013


Author: mmichelson
Date: Fri Feb 15 17:16:39 2013
New Revision: 381593

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=381593
Log:
Resolve endpoint refleak in authenticator module.

Modified:
    team/mmichelson/pool_shark2/res/res_sip/sip_distributor.c

Modified: team/mmichelson/pool_shark2/res/res_sip/sip_distributor.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pool_shark2/res/res_sip/sip_distributor.c?view=diff&rev=381593&r1=381592&r2=381593
==============================================================================
--- team/mmichelson/pool_shark2/res/res_sip/sip_distributor.c (original)
+++ team/mmichelson/pool_shark2/res/res_sip/sip_distributor.c Fri Feb 15 17:16:39 2013
@@ -67,6 +67,7 @@
 
 static pj_bool_t authenticate(pjsip_rx_data *rdata)
 {
+	pj_bool_t res = PJ_FALSE;
 	struct ast_sip_endpoint *endpoint = ast_pjsip_rdata_get_endpoint(rdata);
 	ast_assert(endpoint != NULL);
 
@@ -77,18 +78,24 @@
 		case AST_SIP_AUTHENTICATION_CHALLENGE:
 			/* Send the 401 we created for them */
 			pjsip_endpt_send_response2(ast_sip_get_pjsip_endpoint(), rdata, tdata, NULL, NULL);
-			return PJ_TRUE;
+			res = PJ_TRUE;
+			goto end;
 		case AST_SIP_AUTHENTICATION_SUCCESS:
-			return PJ_FALSE;
+			res = PJ_FALSE;
+			goto end;
 		case AST_SIP_AUTHENTICATION_FAILED:
 			pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 403, NULL, NULL, NULL);
-			return PJ_TRUE;
+			res = PJ_TRUE;
+			goto end;
 		case AST_SIP_AUTHENTICATION_ERROR:
 			pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 500, NULL, NULL, NULL);
-			return PJ_TRUE;
+			res = PJ_TRUE;
+			goto end;
 		}
 	}
-	return PJ_FALSE;
+end:
+	ao2_cleanup(endpoint);
+	return res;
 }
 
 pjsip_module auth_mod = {




More information about the asterisk-commits mailing list