From 17f0d1fefc9864ef2235afe66513ff409b3c5966 Mon Sep 17 00:00:00 2001 From: wangzhen Date: Sat, 1 Jul 2023 18:46:59 +0800 Subject: [PATCH] BugFix: Resolve the problem of srs_error_t memory leak. v5.0.163, v6.0.57 (#3605) --------- Co-authored-by: Haibo Chen <495810242@qq.com> Co-authored-by: chundonglinlin --- trunk/doc/CHANGELOG.md | 1 + trunk/src/app/srs_app_dvr.cpp | 1 + trunk/src/core/srs_core_version5.hpp | 2 +- trunk/src/kernel/srs_kernel_ts.cpp | 6 +++--- trunk/src/kernel/srs_kernel_ts.hpp | 12 ++++++------ 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index 56bfef81ee..b8f6b010f8 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -8,6 +8,7 @@ The changelog for SRS. ## SRS 5.0 Changelog +* v5.0, 2023-07-01, Merge [#3605](https://github.com/ossrs/srs/pull/3605): BugFix: Resolve the problem of srs_error_t memory leak. v5.0.163 (#3605) * v5.0, 2023-06-30, Merge [#3596](https://github.com/ossrs/srs/pull/3596): Improve the usage of "transcode" in the "full.conf" file. v5.0.162 (#3596) * v5.0, 2023-06-21, Merge [#3551](https://github.com/ossrs/srs/pull/3551): H264: Fix H.264 ISOM reserved bit value. v5.0.161 (#3551) * v5.0, 2023-06-20, Merge [#3592](https://github.com/ossrs/srs/pull/3592): Fix Permission Issue in depend.sh for OpenSSL Compilation. v5.0.159 (#3592) diff --git a/trunk/src/app/srs_app_dvr.cpp b/trunk/src/app/srs_app_dvr.cpp index 057a3d3f4e..cbea5ba866 100644 --- a/trunk/src/app/srs_app_dvr.cpp +++ b/trunk/src/app/srs_app_dvr.cpp @@ -737,6 +737,7 @@ void SrsDvrSessionPlan::on_unpublish() srs_error_t err = segment->close(); if (err != srs_success) { srs_warn("ignore flv close error %s", srs_error_desc(err).c_str()); + srs_error_reset(err); } dvr_enabled = false; diff --git a/trunk/src/core/srs_core_version5.hpp b/trunk/src/core/srs_core_version5.hpp index 2617eab4df..8704aaf3d2 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 162 +#define VERSION_REVISION 163 #endif diff --git a/trunk/src/kernel/srs_kernel_ts.cpp b/trunk/src/kernel/srs_kernel_ts.cpp index 26c4672266..3246eff834 100644 --- a/trunk/src/kernel/srs_kernel_ts.cpp +++ b/trunk/src/kernel/srs_kernel_ts.cpp @@ -1820,7 +1820,7 @@ srs_error_t SrsMpegPES::decode_33bits_dts_pts(SrsBuffer* stream, int64_t* pv) } // decode the 33bits schema. - // ===========1B + // ----------1B // 4bits const maybe '0001', '0010' or '0011'. // 3bits DTS/PTS [32..30] // 1bit const '1' @@ -1835,7 +1835,7 @@ srs_error_t SrsMpegPES::decode_33bits_dts_pts(SrsBuffer* stream, int64_t* pv) } dts_pts_30_32 = (dts_pts_30_32 >> 1) & 0x07; - // ===========2B + // ----------2B // 15bits DTS/PTS [29..15] // 1bit const '1' int64_t dts_pts_15_29 = stream->read_2bytes(); @@ -1844,7 +1844,7 @@ srs_error_t SrsMpegPES::decode_33bits_dts_pts(SrsBuffer* stream, int64_t* pv) } dts_pts_15_29 = (dts_pts_15_29 >> 1) & 0x7fff; - // ===========2B + // ----------2B // 15bits DTS/PTS [14..0] // 1bit const '1' int64_t dts_pts_0_14 = stream->read_2bytes(); diff --git a/trunk/src/kernel/srs_kernel_ts.hpp b/trunk/src/kernel/srs_kernel_ts.hpp index 06334e7007..0ba41cfc6b 100644 --- a/trunk/src/kernel/srs_kernel_ts.hpp +++ b/trunk/src/kernel/srs_kernel_ts.hpp @@ -824,14 +824,14 @@ class SrsMpegPES // presentation unit k of elementary stream n. The value of PTS is specified in units of the period of the system clock // frequency divided by 300 (yielding 90 kHz). The presentation time is derived from the PTS according to equation 2-11 // below. Refer to 2.7.4 for constraints on the frequency of coding presentation timestamps. - // ===========1B + // ----------1B // 4bits const // 3bits PTS [32..30] // 1bit const '1' - // ===========2B + // ----------2B // 15bits PTS [29..15] // 1bit const '1' - // ===========2B + // ----------2B // 15bits PTS [14..0] // 1bit const '1' int64_t pts; // 33bits @@ -840,14 +840,14 @@ class SrsMpegPES // The DTS is a 33-bit number coded in three separate fields. It indicates the decoding time, // td n (j), in the system target decoder of an access unit j of elementary stream n. The value of DTS is specified in units of // the period of the system clock frequency divided by 300 (yielding 90 kHz). - // ===========1B + // ----------1B // 4bits const // 3bits DTS [32..30] // 1bit const '1' - // ===========2B + // ----------2B // 15bits DTS [29..15] // 1bit const '1' - // ===========2B + // ----------2B // 15bits DTS [14..0] // 1bit const '1' int64_t dts; // 33bits