Resolve coverity warnings.

14050, 14051, 14243, 14314

In APM:
- Uninitialized variable initialized.
- NULL pointer sanity checks corrected.

Tested with trybots and audioproc_unittest.

BUG=None
TEST=None

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2229 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
bjornv@webrtc.org 2012-05-11 07:51:44 +00:00
parent 7eadad6d95
commit 61d0745e86
3 changed files with 16 additions and 11 deletions

View File

@ -752,7 +752,7 @@ int WebRtcAec_GetDelayMetrics(void* handle, int* median, int* std) {
const int kMsPerBlock = (PART_LEN * 1000) / self->splitSampFreq;
float l1_norm = 0;
if (self == NULL) {
if (handle == NULL) {
return -1;
}
if (median == NULL) {

View File

@ -650,10 +650,12 @@ WebRtc_Word32 WebRtcAecm_InitEchoPath(void* aecmInst,
aecmob_t *aecm = aecmInst;
const WebRtc_Word16* echo_path_ptr = echo_path;
if ((aecm == NULL) || (echo_path == NULL))
{
aecm->lastError = AECM_NULL_POINTER_ERROR;
return -1;
if (aecmInst == NULL) {
return -1;
}
if (echo_path == NULL) {
aecm->lastError = AECM_NULL_POINTER_ERROR;
return -1;
}
if (size_bytes != WebRtcAecm_echo_path_size_bytes())
{
@ -679,10 +681,12 @@ WebRtc_Word32 WebRtcAecm_GetEchoPath(void* aecmInst,
aecmob_t *aecm = aecmInst;
WebRtc_Word16* echo_path_ptr = echo_path;
if ((aecm == NULL) || (echo_path == NULL))
{
aecm->lastError = AECM_NULL_POINTER_ERROR;
return -1;
if (aecmInst == NULL) {
return -1;
}
if (echo_path == NULL) {
aecm->lastError = AECM_NULL_POINTER_ERROR;
return -1;
}
if (size_bytes != WebRtcAecm_echo_path_size_bytes())
{

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
@ -737,7 +737,8 @@ int WebRtcNs_ProcessCore(NSinst_t* inst,
float magn[HALF_ANAL_BLOCKL], noise[HALF_ANAL_BLOCKL];
float theFilter[HALF_ANAL_BLOCKL], theFilterTmp[HALF_ANAL_BLOCKL];
float snrLocPost[HALF_ANAL_BLOCKL], snrLocPrior[HALF_ANAL_BLOCKL];
float probSpeechFinal[HALF_ANAL_BLOCKL], previousEstimateStsa[HALF_ANAL_BLOCKL];
float probSpeechFinal[HALF_ANAL_BLOCKL] = { 0 };
float previousEstimateStsa[HALF_ANAL_BLOCKL];
float real[ANAL_BLOCKL_MAX], imag[HALF_ANAL_BLOCKL];
// Variables during startup
float sum_log_i = 0.0;