Skip to content

Commit

Permalink
asan: Fix memory leak in asan by releasing global IPs when run_direct…
Browse files Browse the repository at this point in the history
…ly_or_daemon fails. v5.0.154, v6.0.44 (#3541)

- Resolved a memory leak issue in asan when run_directly_or_daemon fails
- Previously, global IP lists were not freed, causing asan to report memory leaks
- Updated the code to always free global IP lists, regardless of whether run_directly_or_daemon fails or succeeds

---------

Co-authored-by: chundonglinlin <[email protected]>
  • Loading branch information
2 people authored and winlinvip committed May 14, 2023
1 parent 33db158 commit a570169
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions trunk/doc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The changelog for SRS.

## SRS 5.0 Changelog

* v5.0, 2023-05-13, Merge [#3541](https://github.com/ossrs/srs/pull/3541): asan: Fix memory leak in asan by releasing global IPs when run_directly_or_daemon fails. v5.0.154 (#3541)
* v5.0, 2023-05-12, Merge [#3539](https://github.com/ossrs/srs/pull/3539): WHIP: Improve HTTP DELETE for notifying server unpublish event. v5.0.153 (#3539)
* v5.0, 2023-03-27, Merge [#3450](https://github.com/ossrs/srs/pull/3450): WebRTC: Error message carries the SDP when failed. v5.0.151 (#3450)
* v5.0, 2023-03-25, Merge [#3477](https://github.com/ossrs/srs/pull/3477): Remove unneccessary NULL check in srs_freep. v5.0.150 (#3477)
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core_version5.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

#define VERSION_MAJOR 5
#define VERSION_MINOR 0
#define VERSION_REVISION 153
#define VERSION_REVISION 154

#endif
8 changes: 4 additions & 4 deletions trunk/src/main/srs_main_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,12 @@ srs_error_t do_main(int argc, char** argv, char** envp)
#ifdef SRS_SANITIZER_LOG
__asan_set_error_report_callback(asan_report_callback);
#endif

if ((err = run_directly_or_daemon()) != srs_success) {
return srs_error_wrap(err, "run");
}

err = run_directly_or_daemon();
srs_free_global_system_ips();
if (err != srs_success) {
return srs_error_wrap(err, "run");
}

return err;
}
Expand Down

0 comments on commit a570169

Please sign in to comment.