Skip to content

Commit

Permalink
Asan: Try to fix st_memory_leak for asan check (ossrs#3264)
Browse files Browse the repository at this point in the history
* asan: try to fix st_memory_leak for asan check

* asan: srs_st_unit should be call in hybrid server stop

* Rename st_uninit to st_destroy. v5.0.91

Co-authored-by: winlin <winlin@vip.126.com>
  • Loading branch information
2 people authored and johzzy committed Apr 18, 2023
1 parent 385527c commit ea288de
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions trunk/src/app/srs_app_hybrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ void SrsHybridServer::stop()
ISrsHybridServer* server = *it;
server->stop();
}

srs_st_destroy();
}

SrsServerAdapter* SrsHybridServer::srs()
Expand Down
5 changes: 5 additions & 0 deletions trunk/src/protocol/srs_protocol_st.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ srs_error_t srs_st_init()
return srs_success;
}

void srs_st_destroy(void)
{
st_destroy();
}

void srs_close_stfd(srs_netfd_t& stfd)
{
if (stfd) {
Expand Down
4 changes: 3 additions & 1 deletion trunk/src/protocol/srs_protocol_st.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ typedef void* srs_thread_t;
typedef void* srs_cond_t;
typedef void* srs_mutex_t;

// Initialize st, requires epoll.
// Initialize ST, requires epoll for linux.
extern srs_error_t srs_st_init();
// Destroy ST, free resources for asan detecting.
extern void srs_st_destroy(void);

// Close the netfd, and close the underlayer fd.
// @remark when close, user must ensure io completed.
Expand Down

0 comments on commit ea288de

Please sign in to comment.