Skip to content

Commit

Permalink
fix memory leak of source.
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Sep 5, 2016
1 parent c7b97aa commit 590e951
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions trunk/src/app/srs_app_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,18 @@ int SrsSource::cycle()

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;
}

Expand Down Expand Up @@ -2210,7 +2221,6 @@ int SrsSource::create_consumer(SrsConnection* conn, SrsConsumer*& consumer, bool
{
int ret = ERROR_SUCCESS;

die_at = -1;
consumer = new SrsConsumer(this, conn);
consumers.push_back(consumer);

Expand Down

1 comment on commit 590e951

@winlinvip
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.