[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20630] trunk/blender/source/blender/src/ hddaudio.c: coverity issue CID: 488

Kent Mein mein at cs.umn.edu
Thu Jun 4 17:58:47 CEST 2009


Revision: 20630
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20630
Author:   sirdude
Date:     2009-06-04 17:58:47 +0200 (Thu, 04 Jun 2009)

Log Message:
-----------
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

Modified Paths:
--------------
    trunk/blender/source/blender/src/hddaudio.c

Modified: trunk/blender/source/blender/src/hddaudio.c
===================================================================
--- trunk/blender/source/blender/src/hddaudio.c	2009-06-04 15:44:43 UTC (rev 20629)
+++ trunk/blender/source/blender/src/hddaudio.c	2009-06-04 15:58:47 UTC (rev 20630)
@@ -316,20 +316,22 @@
 	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,





More information about the Bf-blender-cvs mailing list