[Asterisk-code-review] chan sip: Fix leak using contact ACL (asterisk[13])

Joshua C. Colp asteriskteam at digium.com
Mon Dec 10 07:05:32 CST 2018


Joshua C. Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/10742 )

Change subject: chan_sip: Fix leak using contact ACL
......................................................................

chan_sip: Fix leak using contact ACL

Free old peer's contactacl before overwrite it within build_peer.

ASTERISK-28194

Change-Id: Ie580db6494e50cee0e2a44b38e568e34116ff54c
---
M channels/chan_sip.c
1 file changed, 6 insertions(+), 0 deletions(-)

Approvals:
  Sean Bright: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Joshua C. Colp: Approved for Submit



diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index d90c1c7..e1f6f13 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -5267,6 +5267,7 @@
 
 	register_peer_exten(peer, FALSE);
 	ast_free_acl_list(peer->acl);
+	ast_free_acl_list(peer->contactacl);
 	ast_free_acl_list(peer->directmediaacl);
 	if (peer->selfdestruct)
 		ast_atomic_fetchadd_int(&apeerobjs, -1);
@@ -21036,6 +21037,7 @@
 		ast_cli(fd, "  Force rport  : %s\n", force_rport_string(peer->flags));
 		ast_cli(fd, "  Symmetric RTP: %s\n", comedia_string(peer->flags));
 		ast_cli(fd, "  ACL          : %s\n", AST_CLI_YESNO(ast_acl_list_is_empty(peer->acl) == 0));
+		ast_cli(fd, "  ContactACL   : %s\n", AST_CLI_YESNO(ast_acl_list_is_empty(peer->contactacl) == 0));
 		ast_cli(fd, "  DirectMedACL : %s\n", AST_CLI_YESNO(ast_acl_list_is_empty(peer->directmediaacl) == 0));
 		ast_cli(fd, "  T.38 support : %s\n", AST_CLI_YESNO(ast_test_flag(&peer->flags[1], SIP_PAGE2_T38SUPPORT)));
 		ast_cli(fd, "  T.38 EC mode : %s\n", faxec2str(ast_test_flag(&peer->flags[1], SIP_PAGE2_T38SUPPORT)));
@@ -31280,6 +31282,7 @@
 	struct ast_variable *v = v_head;
 	struct sip_peer *peer = NULL;
 	struct ast_acl_list *oldacl = NULL;
+	struct ast_acl_list *oldcontactacl = NULL;
 	struct ast_acl_list *olddirectmediaacl = NULL;
 	int found = 0;
 	int firstpass = 1;
@@ -31359,6 +31362,8 @@
 	if (firstpass) {
 		oldacl = peer->acl;
 		peer->acl = NULL;
+		oldcontactacl = peer->contactacl;
+		peer->contactacl = NULL;
 		olddirectmediaacl = peer->directmediaacl;
 		peer->directmediaacl = NULL;
 		set_peer_defaults(peer);	/* Set peer defaults */
@@ -32022,6 +32027,7 @@
 	peer->the_mark = 0;
 
 	oldacl = ast_free_acl_list(oldacl);
+	oldcontactacl = ast_free_acl_list(oldcontactacl);
 	olddirectmediaacl = ast_free_acl_list(olddirectmediaacl);
 	if (!ast_strlen_zero(peer->callback)) { /* build string from peer info */
 		char *reg_string;

-- 
To view, visit https://gerrit.asterisk.org/10742
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie580db6494e50cee0e2a44b38e568e34116ff54c
Gerrit-Change-Number: 10742
Gerrit-PatchSet: 2
Gerrit-Owner: Giuseppe Sucameli <sucameli at netresults.it>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Friendly Automation (1000185)
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua C. Colp <jcolp at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181210/14aab37b/attachment-0001.html>


More information about the asterisk-code-review mailing list