[asterisk-commits] russell: branch 1.6.2 r317255 - in /branches/1.6.2: ./ channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 5 13:30:03 CDT 2011


Author: russell
Date: Thu May  5 13:29:53 2011
New Revision: 317255

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=317255
Log:
Merged revisions 317211 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r317211 | russell | 2011-05-05 13:20:29 -0500 (Thu, 05 May 2011) | 15 lines
  
  chan_sip: fix broken realtime peer count, fix memory leak
  
  This patch addresses two bugs in chan_sip:
  
  1) The count of realtime peers and users was off.  The increment checked the
  value of the caching option, while the decrement did not.
  
  2) Add a missing regfree() for a regex.
  
  (closes issue #19108)
  Reported by: vrban
  Patches:
        missing_regfree.patch uploaded by vrban (license 756)
        sip_object_counter.patch uploaded by vrban (license 756)
........

Modified:
    branches/1.6.2/   (props changed)
    branches/1.6.2/channels/chan_sip.c

Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: branches/1.6.2/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/channels/chan_sip.c?view=diff&rev=317255&r1=317254&r2=317255
==============================================================================
--- branches/1.6.2/channels/chan_sip.c (original)
+++ branches/1.6.2/channels/chan_sip.c Thu May  5 13:29:53 2011
@@ -4886,7 +4886,7 @@
 	ast_free_ha(peer->ha);
 	if (peer->selfdestruct)
 		ast_atomic_fetchadd_int(&apeerobjs, -1);
-	else if (peer->is_realtime) {
+	else if (!ast_test_flag(&global_flags[1], SIP_PAGE2_RTCACHEFRIENDS) && peer->is_realtime) {
 		ast_atomic_fetchadd_int(&rpeerobjs, -1);
 		ast_debug(3, "-REALTIME- peer Destroyed. Name: %s. Realtime Peer objects: %d\n", peer->name, rpeerobjs);
 	} else
@@ -15607,6 +15607,7 @@
 	int multi = FALSE;
 	char *name = NULL;
 	regex_t regexbuf;
+	int havepattern = 0;
 	struct ao2_iterator i;
 	static char *choices[] = { "all", "like", NULL };
 	char *cmplt;
@@ -15675,8 +15676,10 @@
 	}
 
 	if (multi && name) {
-		if (regcomp(&regexbuf, name, REG_EXTENDED | REG_NOSUB))
+		if (regcomp(&regexbuf, name, REG_EXTENDED | REG_NOSUB)) {
 			return CLI_SHOWUSAGE;
+		}
+		havepattern = 1;
 	}
 
 	if (multi) {
@@ -15727,6 +15730,10 @@
 			} else
 				ast_cli(a->fd, "Peer '%s' not found.\n", name);
 		}
+	}
+
+	if (havepattern) {
+		regfree(&regexbuf);
 	}
 
 	return CLI_SUCCESS;




More information about the asterisk-commits mailing list