mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
fix memory leak of source.
This commit is contained in:
parent
c7b97aa1c3
commit
590e951739
1 changed files with 12 additions and 2 deletions
|
@ -1030,7 +1030,18 @@ int SrsSource::cycle()
|
||||||
|
|
||||||
bool SrsSource::expired()
|
bool SrsSource::expired()
|
||||||
{
|
{
|
||||||
if (!consumers.empty() || die_at == -1) {
|
// unknown state?
|
||||||
|
if (die_at == -1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// still publishing?
|
||||||
|
if (!_can_publish) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// has any consumers?
|
||||||
|
if (!consumers.empty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2210,7 +2221,6 @@ int SrsSource::create_consumer(SrsConnection* conn, SrsConsumer*& consumer, bool
|
||||||
{
|
{
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
|
||||||
die_at = -1;
|
|
||||||
consumer = new SrsConsumer(this, conn);
|
consumer = new SrsConsumer(this, conn);
|
||||||
consumers.push_back(consumer);
|
consumers.push_back(consumer);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue