HLS: Fix a iterator bug in hls_ctx cleanup function. v6.0.182 (#4534)

Co-authored-by: OSSRS-AI <winlinam@gmail.com>
This commit is contained in:
Haibo Chen(陈海博) 2025-10-17 19:16:42 +08:00 committed by winlin
parent 54f5048c2a
commit fcb2992230
3 changed files with 6 additions and 5 deletions

View File

@ -7,6 +7,7 @@ The changelog for SRS.
<a name="v6-changes"></a>
## SRS 6.0 Changelog
* v6.0, 2025-10-17, Merge [#4534](https://github.com/ossrs/srs/pull/4534): HLS: Fix a iterator bug in hls_ctx cleanup function. v6.0.182 (#4534)
* v6.0, 2025-10-14, Disable sanitizer by default to fix memory leak. (#4364) v6.0.181
* v6.0, 2025-10-01, SRT: Support configurable default_streamid option. v6.0.180
* v6.0, 2025-09-27, For Edge, only support RTMP or HTTP-FLV. v6.0.179 (#4512)

View File

@ -355,7 +355,7 @@ srs_error_t SrsHlsStream::on_timer(srs_utime_t interval)
srs_error_t err = srs_success;
std::map<std::string, SrsHlsVirtualConn*>::iterator it;
for (it = map_ctx_info_.begin(); it != map_ctx_info_.end(); ++it) {
for (it = map_ctx_info_.begin(); it != map_ctx_info_.end();) {
string ctx = it->first;
SrsHlsVirtualConn* info = it->second;
@ -370,10 +370,10 @@ srs_error_t SrsHlsStream::on_timer(srs_utime_t interval)
// TODO: FIXME: Should finger out the err.
stat->on_disconnect(ctx, srs_success);
map_ctx_info_.erase(it);
srs_freep(info);
break;
map_ctx_info_.erase(it++);
} else {
++it;
}
}

View File

@ -9,6 +9,6 @@
#define VERSION_MAJOR 6
#define VERSION_MINOR 0
#define VERSION_REVISION 181
#define VERSION_REVISION 182
#endif