coverity issue CID: 488

Checker: REVERSE_INULL (help)
File: base/src/source/blender/src/hddaudio.c
Function: sound_hdaudio_extract_small_block
Description: Pointer "hdaudio" dereferenced before NULL check

Moved some init code that uses a pointer to after the check
to see if pointer is valid.

Kent
This commit is contained in:
Kent Mein
2009-06-04 15:58:47 +00:00
parent 549d1d3742
commit aa0f4fb694

View File

@@ -316,20 +316,22 @@ static void sound_hdaudio_extract_small_block(
int nb_samples /* in target */)
{
AVPacket packet;
int frame_position;
int frame_size = (long long) target_rate
* hdaudio->frame_duration / AV_TIME_BASE;
int in_frame_size = (long long) hdaudio->sample_rate
* hdaudio->frame_duration / AV_TIME_BASE;
int rate_conversion =
(target_rate != hdaudio->sample_rate)
|| (target_channels != hdaudio->channels);
int sample_ofs = target_channels * (sample_position % frame_size);
frame_position = sample_position / frame_size;
int frame_position, frame_size, in_frame_size, rate_conversion;
int sample_ofs;
if (hdaudio == 0) return;
frame_size = (long long) target_rate
* hdaudio->frame_duration / AV_TIME_BASE;
in_frame_size = (long long) hdaudio->sample_rate
* hdaudio->frame_duration / AV_TIME_BASE;
rate_conversion =
(target_rate != hdaudio->sample_rate)
|| (target_channels != hdaudio->channels);
sample_ofs = target_channels * (sample_position % frame_size);
frame_position = sample_position / frame_size;
if (rate_conversion) {
sound_hdaudio_init_resampler(
hdaudio, frame_position,