]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Crash when using hagi and no servers are available.
authorRichard Mudgett <rmudgett@digium.com>
Fri, 27 May 2011 23:45:41 +0000 (23:45 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Fri, 27 May 2011 23:45:41 +0000 (23:45 +0000)
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: https://origsvn.digium.com/svn/asterisk/branches/1.8@321392 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/srv.c

index f4e0ec39aa9b97d0f4bf8d2ab40518dd3ce23246..5a0c7effbfadb7188ec07fa71f0cd3d9c3accaf0 100644 (file)
@@ -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)