diff --git a/main/srv.c b/main/srv.c index f4e0ec39aa..5a0c7effbf 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)