History

src/samplerate.c : Fix a valgrind warning which occured when the call back function returns a count of zero without modifying the pointer value.

Erik de Castro Lopo committed 18 years ago

Commit 2fd33ba1 parent 2df44c22 files · +14 −7Browse files

Showing the changes to src (1 of 2 files). Show all

Unified · Split

src/samplerate.c+8−7
@@ -132,16 +132,13 @@ src_process (SRC_STATE *state, SRC_DATA *data) · 131 unmodified lines
132132 if (data == NULL)
133133 return SRC_ERR_BAD_DATA ;
134134
135− /* Check src_ratio is in range. */
136− if (is_bad_src_ratio (data->src_ratio))
137− return SRC_ERR_BAD_SRC_RATIO ;
138−
139135 /* And that data_in and data_out are valid. */
140136 if (data->data_in == NULL || data->data_out == NULL)
141137 return SRC_ERR_BAD_DATA_PTR ;
142138
143− if (data->data_in == NULL)
144− data->input_frames = 0 ;
139+ /* Check src_ratio is in range. */
140+ if (is_bad_src_ratio (data->src_ratio))
141+ return SRC_ERR_BAD_SRC_RATIO ;
145142
146143 if (data->input_frames < 0)
147144 data->input_frames = 0 ;
@@ -226,7 +223,11 @@ src_callback_read (SRC_STATE *state, double src_ratio, long frames, float *data) · 78 unmodified lines
226223 while (output_frames_gen < frames)
227224 {
228225 if (src_data.input_frames == 0)
229− { float *ptr ;
226+ { /* Use a dummy array for the case where the callback function
227+ ** returns without setting the ptr.
228+ */
229+ float dummy [1] ;
230+ float *ptr = dummy ;
230231
231232 src_data.input_frames = psrc->callback_func (psrc->user_callback_data, &ptr) ;
232233 src_data.data_in = ptr ;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t