diff options
author | Kent Mein <mein@cs.umn.edu> | 2009-06-04 19:58:47 +0400 |
---|---|---|
committer | Kent Mein <mein@cs.umn.edu> | 2009-06-04 19:58:47 +0400 |
commit | aa0f4fb6940c61446173010863e6a4ce871d0eeb (patch) | |
tree | 54e11f2cbd95877de0427b4f9e5003ed5b098515 /source | |
parent | 549d1d37420637cb307a1ca85f157392dbcc26ea (diff) |
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
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/src/hddaudio.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/source/blender/src/hddaudio.c b/source/blender/src/hddaudio.c index bfddd29b198..2aa434e4ac7 100644 --- a/source/blender/src/hddaudio.c +++ b/source/blender/src/hddaudio.c @@ -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 + 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; - int in_frame_size = (long long) hdaudio->sample_rate + in_frame_size = (long long) hdaudio->sample_rate * hdaudio->frame_duration / AV_TIME_BASE; - int rate_conversion = + rate_conversion = (target_rate != hdaudio->sample_rate) || (target_channels != hdaudio->channels); - int sample_ofs = target_channels * (sample_position % frame_size); + sample_ofs = target_channels * (sample_position % frame_size); frame_position = sample_position / frame_size; - if (hdaudio == 0) return; - if (rate_conversion) { sound_hdaudio_init_resampler( hdaudio, frame_position, |