Skip to content

Commit

Permalink
fix bug //@see ossrs#2311
Browse files Browse the repository at this point in the history
  • Loading branch information
chenhaibo committed May 14, 2021
1 parent fec44ba commit d5b28ad
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
9 changes: 2 additions & 7 deletions trunk/src/app/srs_app_hls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,8 @@ srs_error_t SrsHlsMuxer::update_config(SrsRequest* r, string entry_prefix,
{
srs_error_t err = srs_success;

// @see https://github.com/ossrs/srs/issues/2311
if (req) {
req->update_auth(r);
}
else {
req = r->copy();
}
srs_freep(req);
req = r->copy();

hls_entry_prefix = entry_prefix;
hls_path = path;
Expand Down
10 changes: 4 additions & 6 deletions trunk/src/app/srs_app_http_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,8 @@ SrsBufferCache::~SrsBufferCache()

srs_error_t SrsBufferCache::update(SrsSource* s, SrsRequest* r)
{
// @see https://github.com/ossrs/srs/issues/2311
req->update_auth(r);

srs_freep(req);
req = r->copy();
source = s;

return srs_success;
Expand Down Expand Up @@ -532,9 +531,8 @@ srs_error_t SrsLiveStream::update(SrsSource* s, SrsRequest* r)
{
source = s;

// @see https://github.com/ossrs/srs/issues/2311
req->update_auth(r);
req->as_http();
srs_freep(req);
req = r->copy()->as_http();

return srs_success;
}
Expand Down
9 changes: 7 additions & 2 deletions trunk/src/app/srs_app_statistic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ SrsStatisticClient::SrsStatisticClient()

SrsStatisticClient::~SrsStatisticClient()
{
srs_freep(req);
}

srs_error_t SrsStatisticClient::dumps(SrsJsonObject* obj)
Expand Down Expand Up @@ -457,11 +458,15 @@ srs_error_t SrsStatistic::on_client(SrsContextId cid, SrsRequest* req, ISrsExpir

// got client.
client->conn = conn;
client->req = req;
client->type = type;
stream->nb_clients++;
vhost->nb_clients++;


// The req might be freed, in such as SrsLiveStream::update, so we must copy it.
// @see https://github.com/ossrs/srs/issues/2311
srs_freep(client->req);
client->req = req->copy();

return err;
}

Expand Down

0 comments on commit d5b28ad

Please sign in to comment.