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:
parent
e22d1dffc1
commit
a8cc3a3430
3 changed files with 9 additions and 3 deletions
|
@ -832,6 +832,7 @@ srs_error_t SrsGoApiRtcPlay::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMe
|
||||||
|
|
||||||
// Parse req, the request json object, from body.
|
// Parse req, the request json object, from body.
|
||||||
SrsJsonObject* req = NULL;
|
SrsJsonObject* req = NULL;
|
||||||
|
SrsAutoFree(SrsJsonObject, req);
|
||||||
if (true) {
|
if (true) {
|
||||||
string req_json;
|
string req_json;
|
||||||
if ((err = r->body_read_all(req_json)) != srs_success) {
|
if ((err = r->body_read_all(req_json)) != srs_success) {
|
||||||
|
|
|
@ -538,6 +538,9 @@ srs_error_t SrsRtc::on_audio(SrsSharedPtrMessage* shared_audio, SrsFormat* forma
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream) {
|
if (stream) {
|
||||||
|
char* stream_data = stream->data();
|
||||||
|
SrsAutoFreeA(char, stream_data);
|
||||||
|
|
||||||
return rtp_opus_muxer->frame_to_packet(shared_audio, format, stream);
|
return rtp_opus_muxer->frame_to_packet(shared_audio, format, stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1339,9 +1339,11 @@ void SrsRtcServer::clear()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < (int)mmhdrs.size(); i++) {
|
for (int i = 0; i < (int)mmhdrs.size(); i++) {
|
||||||
msghdr* hdr = &mmhdrs[i].msg_hdr;
|
msghdr* hdr = &mmhdrs[i].msg_hdr;
|
||||||
for (int i = 0; i < (int)hdr->msg_iovlen; i++) {
|
for (int j = (int)hdr->msg_iovlen - 1; j >= 0 ; j--) {
|
||||||
iovec* iov = hdr->msg_iov + i;
|
iovec* iov = hdr->msg_iov + j;
|
||||||
delete (char*)iov->iov_base;
|
char* data = (char*)iov->iov_base;
|
||||||
|
srs_freep(data);
|
||||||
|
srs_freep(iov);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue