mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-19 19:52:48 +00:00
Fix a potential timer leak in bridge_softmix.
It is possible for a bridge to be created without actually being used. In that scenario a timing file descriptor would be opened and not closed. To fix this the timing file descriptor is now closed in the destroy callback, not the thread function. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@184677 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -96,6 +96,16 @@ static int softmix_bridge_create(struct ast_bridge *bridge)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! \brief Function called when a bridge is destroyed */
|
||||||
|
static int softmix_bridge_destroy(struct ast_bridge *bridge)
|
||||||
|
{
|
||||||
|
int timingfd = (unsigned long)bridge->bridge_pvt;
|
||||||
|
|
||||||
|
ast_timer_close(timingfd);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*! \brief Function called when a channel is joined into the bridge */
|
/*! \brief Function called when a channel is joined into the bridge */
|
||||||
static int softmix_bridge_join(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
|
static int softmix_bridge_join(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
|
||||||
{
|
{
|
||||||
@@ -263,8 +273,6 @@ static int softmix_bridge_thread(struct ast_bridge *bridge)
|
|||||||
ao2_lock(bridge);
|
ao2_lock(bridge);
|
||||||
}
|
}
|
||||||
|
|
||||||
ast_timer_close(timingfd);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,6 +286,7 @@ static struct ast_bridge_technology softmix_bridge = {
|
|||||||
.formats = AST_FORMAT_SLINEAR,
|
.formats = AST_FORMAT_SLINEAR,
|
||||||
#endif
|
#endif
|
||||||
.create = softmix_bridge_create,
|
.create = softmix_bridge_create,
|
||||||
|
.destroy = softmix_bridge_destroy,
|
||||||
.join = softmix_bridge_join,
|
.join = softmix_bridge_join,
|
||||||
.leave = softmix_bridge_leave,
|
.leave = softmix_bridge_leave,
|
||||||
.write = softmix_bridge_write,
|
.write = softmix_bridge_write,
|
||||||
|
Reference in New Issue
Block a user