Skip to content

Commit

Permalink
Fix some memory leak issues.
Browse files Browse the repository at this point in the history
Free memory in some places.
  • Loading branch information
yidaoru committed Sep 6, 2016
1 parent 4b500ee commit 506a62b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions openmcu-ru/reg_sip.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,15 @@ int Registrar::OnReceivedSipInvite(const msg_t *msg)
if(raccount_out) raccount_out->Unlock();
if(rconn) rconn->Unlock();
if(response_code == 0)
{
msg_destroy(msg_reply);
return 0;
}
else if(response_code == -1)
{
sep->CreateIncomingConnection(msg); // MCU call
msg_destroy(msg_reply);
}
else
sep->SipReqReply(msg, msg_reply, response_code);
return 1;
Expand Down
1 change: 1 addition & 0 deletions openmcu-ru/sockets.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ BOOL MCUSocket::GetFromIP(PString & ip, const PString & host, const PString & po
PTRACE(1, "MCUSocket error " << errno << " " << strerror(errno));
return FALSE;
}
freeaddrinfo(res);

sockaddr_in name;
socklen_t namelen = sizeof(name);
Expand Down
4 changes: 2 additions & 2 deletions openmcu-ru/utils_av.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -476,14 +476,14 @@ BOOL MCU_AVDecodeFrameFromFile(PString & filename, void *dst, int & dst_size, in
}

end:
if(fmt_ctx)
avformat_close_input(&fmt_ctx);
if(context)
{
avcodecMutex.Wait();
avcodec_close(context);
avcodecMutex.Signal();
}
if(fmt_ctx)
avformat_close_input(&fmt_ctx);
if(frame)
AVFrameFree(&frame);

Expand Down

0 comments on commit 506a62b

Please sign in to comment.