[asterisk-commits] russell: branch 1.4 r317211 - /branches/1.4/channels/chan_sip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu May 5 13:20:37 CDT 2011
Author: russell
Date: Thu May 5 13:20:29 2011
New Revision: 317211
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=317211
Log:
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.4/channels/chan_sip.c
Modified: branches/1.4/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=317211&r1=317210&r2=317211
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Thu May 5 13:20:29 2011
@@ -2770,7 +2770,7 @@
ast_free_ha(peer->ha);
if (ast_test_flag(&peer->flags[1], SIP_PAGE2_SELFDESTRUCT))
apeerobjs--;
- else if (ast_test_flag(&peer->flags[0], SIP_REALTIME))
+ else if (!ast_test_flag(&global_flags[1], SIP_PAGE2_RTCACHEFRIENDS) && ast_test_flag(&peer->flags[0], SIP_REALTIME))
rpeerobjs--;
else
speerobjs--;
@@ -2978,7 +2978,7 @@
ast_variables_destroy(user->chanvars);
user->chanvars = NULL;
}
- if (ast_test_flag(&user->flags[0], SIP_REALTIME))
+ if (!ast_test_flag(&global_flags[1], SIP_PAGE2_RTCACHEFRIENDS) && ast_test_flag(&user->flags[0], SIP_REALTIME))
ruserobjs--;
else
suserobjs--;
@@ -11477,6 +11477,7 @@
int multi = FALSE;
char *name = NULL;
regex_t regexbuf;
+ int havepattern = 0;
switch (argc) {
case 4:
@@ -11535,8 +11536,10 @@
}
if (multi && name) {
- if (regcomp(®exbuf, name, REG_EXTENDED | REG_NOSUB))
+ if (regcomp(®exbuf, name, REG_EXTENDED | REG_NOSUB)) {
return RESULT_SHOWUSAGE;
+ }
+ havepattern = 1;
}
if (multi) {
@@ -11609,6 +11612,10 @@
} else
ast_cli(fd, "User '%s' not found.\n", name);
}
+ }
+
+ if (havepattern) {
+ regfree(®exbuf);
}
return RESULT_SUCCESS;
More information about the asterisk-commits
mailing list