1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-15 04:42:04 +00:00

For #307, fix some memory leaking

This commit is contained in:
winlin 2020-04-07 19:07:11 +08:00
parent e22d1dffc1
commit a8cc3a3430
3 changed files with 9 additions and 3 deletions

View file

@ -832,6 +832,7 @@ srs_error_t SrsGoApiRtcPlay::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMe
// Parse req, the request json object, from body.
SrsJsonObject* req = NULL;
SrsAutoFree(SrsJsonObject, req);
if (true) {
string req_json;
if ((err = r->body_read_all(req_json)) != srs_success) {

View file

@ -538,6 +538,9 @@ srs_error_t SrsRtc::on_audio(SrsSharedPtrMessage* shared_audio, SrsFormat* forma
}
if (stream) {
char* stream_data = stream->data();
SrsAutoFreeA(char, stream_data);
return rtp_opus_muxer->frame_to_packet(shared_audio, format, stream);
}

View file

@ -1339,9 +1339,11 @@ void SrsRtcServer::clear()
{
for (int i = 0; i < (int)mmhdrs.size(); i++) {
msghdr* hdr = &mmhdrs[i].msg_hdr;
for (int i = 0; i < (int)hdr->msg_iovlen; i++) {
iovec* iov = hdr->msg_iov + i;
delete (char*)iov->iov_base;
for (int j = (int)hdr->msg_iovlen - 1; j >= 0 ; j--) {
iovec* iov = hdr->msg_iov + j;
char* data = (char*)iov->iov_base;
srs_freep(data);
srs_freep(iov);
}
}