diff options
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r-- | channels/chan_sip.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 09aec761f..6d532760f 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -4512,7 +4512,7 @@ static void sip_destroy_peer(struct sip_peer *peer) ast_free_ha(peer->directmediaha); 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 @@ -16562,6 +16562,7 @@ static char *sip_prune_realtime(struct ast_cli_entry *e, int cmd, struct ast_cli int multi = FALSE; const char *name = NULL; regex_t regexbuf; + int havepattern = 0; struct ao2_iterator i; static const char * const choices[] = { "all", "like", NULL }; 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 (regcomp(®exbuf, name, REG_EXTENDED | REG_NOSUB)) + if (regcomp(®exbuf, name, REG_EXTENDED | REG_NOSUB)) { return CLI_SHOWUSAGE; + } + havepattern = 1; } 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; } |