aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrmudgett <rmudgett@f38db490-d61c-443f-a65b-d21fe96a405b>2011-05-27 23:46:07 +0000
committerrmudgett <rmudgett@f38db490-d61c-443f-a65b-d21fe96a405b>2011-05-27 23:46:07 +0000
commitc3d299d2917e7025b788d19a5f453f1e1f4da987 (patch)
treec721b3d8d8fe8704257625f6863ed2d5b64daff5
parentc02794a6c1122282264c582a7d806ec7d5d5d2a1 (diff)
Merged revisions 321392 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r321392 | rmudgett | 2011-05-27 18:45:41 -0500 (Fri, 27 May 2011) | 12 lines Crash when using hagi and no servers are available. When none of the servers returned by the SRV querey respond, asterisk crashes. The problem is that if the loop over all the SRV entries finishes then the srv_context has already been cleaned up. * Make ast_srv_cleanup() check to see if the context is already cleaned up. (closes issue #19256) Reported by: byronclark ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@321393 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--main/srv.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/main/srv.c b/main/srv.c
index f4e0ec39a..5a0c7effb 100644
--- a/main/srv.c
+++ b/main/srv.c
@@ -249,7 +249,11 @@ void ast_srv_cleanup(struct srv_context **context)
const char *host;
unsigned short port;
- while (!(ast_srv_lookup(context, NULL, &host, &port)));
+ if (*context) {
+ /* We have a context to clean up. */
+ while (!(ast_srv_lookup(context, NULL, &host, &port))) {
+ }
+ }
}
int ast_get_srv(struct ast_channel *chan, char *host, int hostlen, int *port, const char *service)