From 909c9efa40257793c35e1b976a2a7686a637385d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Haibo=20Chen=28=E9=99=88=E6=B5=B7=E5=8D=9A=29?= <495810242@qq.com> Date: Fri, 21 Mar 2025 10:38:08 +0800 Subject: [PATCH] free sample to prevent memory leak. v5.0.222 v6.0.164 v7.0.26 (#4305) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复`SrsRtpRawPayload::copy()`方法中sample_覆盖的问题。 --------- Co-authored-by: chundonglinlin Co-authored-by: winlin --------- Co-authored-by: john --- trunk/doc/CHANGELOG.md | 3 +++ trunk/src/core/srs_core_version5.hpp | 2 +- trunk/src/core/srs_core_version6.hpp | 2 +- trunk/src/core/srs_core_version7.hpp | 2 +- trunk/src/kernel/srs_kernel_rtc_rtp.cpp | 3 +++ 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index 0d973bd97..f871afba1 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -7,6 +7,7 @@ The changelog for SRS. ## SRS 7.0 Changelog +* v7.0, 2025-03-20, Merge [#4305](https://github.com/ossrs/srs/pull/4305): free sample to prevent memory leak. v7.0.26 (#4305) * v7.0, 2025-03-18, Merge [#4302](https://github.com/ossrs/srs/pull/4302): update geekyeggo/delete-artifact to 5.0.0. v7.0.25 (#4302) * v7.0, 2025-03-06, Merge [#4296](https://github.com/ossrs/srs/pull/4296): Dvr: support h265 flv fragments. v7.0.24 (#4296) * v7.0, 2025-02-20, Merge [#4253](https://github.com/ossrs/srs/pull/4253): fix typo about heartbeat. v7.0.23 (#4253) @@ -37,6 +38,7 @@ The changelog for SRS. ## SRS 6.0 Changelog +* v6.0, 2025-03-20, Merge [#4305](https://github.com/ossrs/srs/pull/4305): free sample to prevent memory leak. v6.0.164 (#4305) * v6.0, 2025-03-18, Merge [#4302](https://github.com/ossrs/srs/pull/4302): update geekyeggo/delete-artifact to 5.0.0. v6.0.163 (#4302) * v6.0, 2025-03-06, Merge [#4296](https://github.com/ossrs/srs/pull/4296): Dvr: support h265 flv fragments. v6.0.162 (#4296) * v6.0, 2025-02-20, Merge [#4253](https://github.com/ossrs/srs/pull/4253): fix typo about heartbeat. v6.0.161 (#4253) @@ -204,6 +206,7 @@ The changelog for SRS. ## SRS 5.0 Changelog +* v5.0, 2025-03-20, Merge [#4305](https://github.com/ossrs/srs/pull/4305): free sample to prevent memory leak. v5.0.222 (#4305) * v5.0, 2025-03-18, Merge [#4302](https://github.com/ossrs/srs/pull/4302): update geekyeggo/delete-artifact to 5.0.0. v5.0.221 (#4302) * v5.0, 2025-02-20, Merge [#4253](https://github.com/ossrs/srs/pull/4253): fix typo about heartbeat. v5.0.220 (#4253) * v5.0, 2025-02-19, Merge [#4291](https://github.com/ossrs/srs/pull/4291): fix ci error. v5.0.219 (#4291) diff --git a/trunk/src/core/srs_core_version5.hpp b/trunk/src/core/srs_core_version5.hpp index 87adb77fc..52c41ec2e 100644 --- a/trunk/src/core/srs_core_version5.hpp +++ b/trunk/src/core/srs_core_version5.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 5 #define VERSION_MINOR 0 -#define VERSION_REVISION 221 +#define VERSION_REVISION 222 #endif diff --git a/trunk/src/core/srs_core_version6.hpp b/trunk/src/core/srs_core_version6.hpp index 5b12e3814..982dda3af 100644 --- a/trunk/src/core/srs_core_version6.hpp +++ b/trunk/src/core/srs_core_version6.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 6 #define VERSION_MINOR 0 -#define VERSION_REVISION 163 +#define VERSION_REVISION 164 #endif diff --git a/trunk/src/core/srs_core_version7.hpp b/trunk/src/core/srs_core_version7.hpp index 96ef62a32..b771987aa 100644 --- a/trunk/src/core/srs_core_version7.hpp +++ b/trunk/src/core/srs_core_version7.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 7 #define VERSION_MINOR 0 -#define VERSION_REVISION 25 +#define VERSION_REVISION 26 #endif \ No newline at end of file diff --git a/trunk/src/kernel/srs_kernel_rtc_rtp.cpp b/trunk/src/kernel/srs_kernel_rtc_rtp.cpp index f5d597813..7b08532d9 100644 --- a/trunk/src/kernel/srs_kernel_rtc_rtp.cpp +++ b/trunk/src/kernel/srs_kernel_rtc_rtp.cpp @@ -1021,6 +1021,9 @@ ISrsRtpPayloader* SrsRtpRawPayload::copy() cp->payload = payload; cp->nn_payload = nn_payload; + + // free sample to prevent memory leak. + srs_freep(cp->sample_); cp->sample_ = sample_->copy(); return cp;