From 1bca6d2437e58d0eb7389eb4cd2460165c4f3ef6 Mon Sep 17 00:00:00 2001 From: "stefan@webrtc.org" Date: Mon, 21 May 2012 07:42:12 +0000 Subject: [PATCH] Fixes coverity warnings. BUG= TEST= Review URL: https://webrtc-codereview.appspot.com/566014 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2262 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../rtp_rtcp/source/rtp_format_vp8_test_helper.cc | 3 ++- src/modules/video_coding/codecs/vp8/main/source/vp8.cc | 9 +++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/modules/rtp_rtcp/source/rtp_format_vp8_test_helper.cc b/src/modules/rtp_rtcp/source/rtp_format_vp8_test_helper.cc index 59e76ee87c..bf858c5b07 100644 --- a/src/modules/rtp_rtcp/source/rtp_format_vp8_test_helper.cc +++ b/src/modules/rtp_rtcp/source/rtp_format_vp8_test_helper.cc @@ -20,6 +20,7 @@ namespace test { RtpFormatVp8TestHelper::RtpFormatVp8TestHelper(const RTPVideoHeaderVP8* hdr) : payload_data_(NULL), buffer_(NULL), + data_ptr_(NULL), fragmentation_(NULL), hdr_info_(hdr), sloppy_partitioning_(false), @@ -67,7 +68,7 @@ void RtpFormatVp8TestHelper::GetAllPacketsAndCheck( int expected_num_packets) { ASSERT_TRUE(inited_); int send_bytes = 0; - bool last; + bool last = false; for (int i = 0; i < expected_num_packets; ++i) { std::ostringstream ss; ss << "Checking packet " << i; diff --git a/src/modules/video_coding/codecs/vp8/main/source/vp8.cc b/src/modules/video_coding/codecs/vp8/main/source/vp8.cc index 508e9b3321..cc0d91be69 100644 --- a/src/modules/video_coding/codecs/vp8/main/source/vp8.cc +++ b/src/modules/video_coding/codecs/vp8/main/source/vp8.cc @@ -79,7 +79,6 @@ int VP8Encoder::Release() { } if (raw_ != NULL) { vpx_img_free(raw_); - delete raw_; raw_ = NULL; } #if WEBRTC_LIBVPX_VERSION >= 971 @@ -153,9 +152,6 @@ int VP8Encoder::InitEncode(const VideoCodec* inst, if (config_ == NULL) { config_ = new vpx_codec_enc_cfg_t; } - if (raw_ == NULL) { - raw_ = new vpx_image_t; - } timestamp_ = 0; codec_ = *inst; @@ -178,7 +174,7 @@ int VP8Encoder::InitEncode(const VideoCodec* inst, encoded_image_._buffer = new uint8_t[encoded_image_._size]; encoded_image_._completeFrame = true; - vpx_img_alloc(raw_, IMG_FMT_I420, codec_.width, codec_.height, 32); + raw_ = vpx_img_alloc(NULL, IMG_FMT_I420, codec_.width, codec_.height, 32); // populate encoder configuration with default values if (vpx_codec_enc_config_default(vpx_codec_vp8_cx(), config_, 0)) { return WEBRTC_VIDEO_CODEC_ERROR; @@ -709,7 +705,8 @@ int VP8Decoder::Decode(const EncodedImage& input_image, propagation_cnt_ = 0; return WEBRTC_VIDEO_CODEC_ERROR; } - img = vpx_codec_get_frame(decoder_, &iter); + // We don't render this frame. + vpx_codec_get_frame(decoder_, &iter); iter = NULL; }