Fixed some memory leaks.

Review URL: https://webrtc-codereview.appspot.com/558004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2165 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pwestin@webrtc.org 2012-05-03 11:32:25 +00:00
parent 63a509858d
commit e9727cdbaa
3 changed files with 11 additions and 12 deletions

View File

@ -63,6 +63,13 @@ BitrateControllerImpl::BitrateControllerImpl()
}
BitrateControllerImpl::~BitrateControllerImpl() {
std::map<BitrateObserver*, BitrateConfiguration*>::iterator it =
bitrate_observers_.begin();
while (it != bitrate_observers_.end()) {
delete it->second;
bitrate_observers_.erase(it);
it = bitrate_observers_.begin();
}
delete critsect_;
}

View File

@ -2726,6 +2726,7 @@ WebRtc_Word32 UdpTransport::LocalHostAddress(WebRtc_UWord32& localIP)
++size;
// Buffer size needed is unknown. Try increasing it until no overflow
// occurs.
// TODO(pwestin) memory leak
if (NULL == (ifc.ifc_req = (ifreq*)realloc(ifc.ifc_req, IFRSIZE))) {
fprintf(stderr, "Out of memory.\n");
exit(EXIT_FAILURE);

View File

@ -75,7 +75,7 @@ ViEChannel::ViEChannel(WebRtc_Word32 channel_id,
decode_thread_(NULL),
external_encryption_(NULL),
effect_filter_(NULL),
color_enhancement_(true),
color_enhancement_(false),
vcm_rttreported_(TickTime::Now()),
file_recorder_(channel_id),
mtu_(0) {
@ -117,7 +117,7 @@ WebRtc_Word32 ViEChannel::Init() {
return -1;
}
rtp_rtcp_.RegisterRtcpObservers(intra_frame_observer_,
bandwidth_observer_,
bandwidth_observer_.get(),
this);
if (module_process_thread_.RegisterModule(&rtp_rtcp_) != 0) {
@ -271,7 +271,7 @@ WebRtc_Word32 ViEChannel::SetSendCodec(const VideoCodec& video_codec,
return -1;
}
rtp_rtcp->RegisterRtcpObservers(intra_frame_observer_,
bandwidth_observer_,
bandwidth_observer_.get(),
this);
if (rtp_rtcp->RegisterSendTransport(
@ -1973,15 +1973,6 @@ WebRtc_Word32 ViEChannel::EnableColorEnhancement(bool enable) {
"%s(enable: %d)", __FUNCTION__, enable);
CriticalSectionScoped cs(callback_cs_.get());
if (enable && color_enhancement_) {
WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_),
"%s: Already enabled", __FUNCTION__);
return -1;
} else if (!enable && !color_enhancement_) {
WEBRTC_TRACE(kTraceWarning, kTraceVideo, ViEId(engine_id_, channel_id_),
"%s: not enabled", __FUNCTION__);
return -1;
}
color_enhancement_ = enable;
return 0;
}