mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-01 19:43:03 +00:00
Merged revisions 317281 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ r317281 | russell | 2011-05-05 13:39:44 -0500 (Thu, 05 May 2011) | 29 lines Merged revisions 317255 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ................ r317255 | russell | 2011-05-05 13:29:53 -0500 (Thu, 05 May 2011) | 22 lines 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) ........ ................ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@317282 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -4512,7 +4512,7 @@ static void sip_destroy_peer(struct sip_peer *peer)
|
|||||||
ast_free_ha(peer->directmediaha);
|
ast_free_ha(peer->directmediaha);
|
||||||
if (peer->selfdestruct)
|
if (peer->selfdestruct)
|
||||||
ast_atomic_fetchadd_int(&apeerobjs, -1);
|
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_atomic_fetchadd_int(&rpeerobjs, -1);
|
||||||
ast_debug(3, "-REALTIME- peer Destroyed. Name: %s. Realtime Peer objects: %d\n", peer->name, rpeerobjs);
|
ast_debug(3, "-REALTIME- peer Destroyed. Name: %s. Realtime Peer objects: %d\n", peer->name, rpeerobjs);
|
||||||
} else
|
} else
|
||||||
@@ -16562,6 +16562,7 @@ static char *sip_prune_realtime(struct ast_cli_entry *e, int cmd, struct ast_cli
|
|||||||
int multi = FALSE;
|
int multi = FALSE;
|
||||||
const char *name = NULL;
|
const char *name = NULL;
|
||||||
regex_t regexbuf;
|
regex_t regexbuf;
|
||||||
|
int havepattern = 0;
|
||||||
struct ao2_iterator i;
|
struct ao2_iterator i;
|
||||||
static const char * const choices[] = { "all", "like", NULL };
|
static const char * const choices[] = { "all", "like", NULL };
|
||||||
char *cmplt;
|
char *cmplt;
|
||||||
@@ -16630,8 +16631,10 @@ static char *sip_prune_realtime(struct ast_cli_entry *e, int cmd, struct ast_cli
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (multi && name) {
|
if (multi && name) {
|
||||||
if (regcomp(®exbuf, name, REG_EXTENDED | REG_NOSUB))
|
if (regcomp(®exbuf, name, REG_EXTENDED | REG_NOSUB)) {
|
||||||
return CLI_SHOWUSAGE;
|
return CLI_SHOWUSAGE;
|
||||||
|
}
|
||||||
|
havepattern = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (multi) {
|
if (multi) {
|
||||||
@@ -16683,6 +16686,10 @@ static char *sip_prune_realtime(struct ast_cli_entry *e, int cmd, struct ast_cli
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (havepattern) {
|
||||||
|
regfree(®exbuf);
|
||||||
|
}
|
||||||
|
|
||||||
return CLI_SUCCESS;
|
return CLI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user