Hi,
Attached are the results of a run of the static code analyzer
tool 'cppcheck'. In generally, I find it a good tool to find silly
little mistakes in code. It's not perfect of course, it may find
false positives and may let slip a few bugs through.
The attached patch fixes the most obvious mistakes, an out-of-bounds
error in src/ampexp.c and an unitialised (and unused) variable in
src/quantise.c
Most of the warnings from cppcheck probably need a more thorough look
with more knowledge of the code.
Kinds regards,
Bertrik
[build/CMakeFiles/CompilerIdC/CMakeCCompilerId.c]: (information) Interrupted
checking because of too many #ifdef configurations.
[build/CMakeFiles/CompilerIdCXX/CMakeCXXCompilerId.cpp]: (information)
Interrupted checking because of too many #ifdef configurations.
[fltk/fl_fdmdv.cxx:301]: (error) Mismatching allocation and deallocation:
Waterfall::pixel_buf
[src/c2dec.c:202]: (error) fflush() called on input stream "stdin" may result
in undefined behaviour
[src/c2enc.c:97]: (error) fflush() called on input stream "stdin" may result in
undefined behaviour
[src/c2sim.c:876]: (error) Resource leak: fjvm
[src/fdmdv_demod.c:251]: (error) Memory leak: packed_bits
[src/fdmdv_demod.c:215]: (error) fflush() called on input stream "stdin" may
result in undefined behaviour
[src/fdmdv_interleave.c:153]: (error) fflush() called on input stream "stdin"
may result in undefined behaviour
[src/fdmdv_mod.c:140]: (error) fflush() called on input stream "stdin" may
result in undefined behaviour
[src/fdmdv_put_test_bits.c:173]: (error) Memory leak: packed_bits
[src/fdmdv_put_test_bits.c:165]: (error) fflush() called on input stream
"stdin" may result in undefined behaviour
[src/fec_dec.c:292]: (error) fflush() called on input stream "stdin" may result
in undefined behaviour
[src/fec_enc.c:293]: (error) fflush() called on input stream "stdin" may result
in undefined behaviour
[src/insert_errors.c:111]: (error) fflush() called on input stream "stdin" may
result in undefined behaviour
[stm32/dl/STM32F4xx_DSP_StdPeriph_Lib_V1.3.0/Utilities/STM32_EVAL/STM324x7I_EVAL/stm324x7i_eval_audio_codec.c]:
(information) Interrupted checking because of too many #ifdef configurations.
[stm32/dl/STM32F4xx_DSP_StdPeriph_Lib_V1.3.0/Utilities/Third_Party/fat_fs/src/ff.c]:
(information) Interrupted checking because of too many #ifdef configurations.
[stm32/src/dac_it.c:168]: (error) Invalid number of character (() when these
macros are defined: ''.
[unittest/create_interleaver.c:47]: (error) Memory leak: interleaver
[unittest/ge_train.c:298]: (error) Memory leak: codebook
[unittest/ge_train.c:298]: (error) Memory leak: codebook2
[unittest/ge_train.c:298]: (error) Memory leak: codebook3
[unittest/ge_train.c:298]: (error) Memory leak: weight
[unittest/ge_train.c:298]: (error) Memory leak: weight2
[unittest/ge_train.c:298]: (error) Memory leak: weight3
[unittest/ge_train.c:298]: (error) Memory leak: delta
[unittest/genampdata.c:103]: (error) Resource leak: f
[unittest/genphdata.c:92]: (error) Resource leak: f
[unittest/mksine.c:41]: (error) Resource leak: f
[unittest/mksine.c:41]: (error) Memory leak: buf
[unittest/sd.c:71]: (error) Array index -1 is out of bounds
[unittest/sd.c:72]: (error) Array index -1 is out of bounds
[unittest/vq_train_jvm.c:485]: (error) Resource leak: ftrain
[unittest/vq_train_jvm.c:485]: (error) Memory leak: codebook
[unittest/vq_train_jvm.c:485]: (error) Memory leak: codebook2
[unittest/vq_train_jvm.c:485]: (error) Memory leak: codebook3
[unittest/vq_train_jvm.c:485]: (error) Memory leak: weight
[unittest/vq_train_jvm.c:485]: (error) Memory leak: weight2
[unittest/vq_train_jvm.c:485]: (error) Memory leak: weight3
[unittest/vqtrain.c:184]: (error) Memory leak: vec
[unittest/vqtrain.c:183]: (error) Memory leak: n
[unittest/vqtrain.c:183]: (error) Resource leak: ftrain
[unittest/vqtrainjnd.c:215]: (error) Memory leak: vec
[unittest/vqtrainjnd.c:215]: (error) Memory leak: n
[unittest/vqtrainjnd.c:215]: (error) Resource leak: ftrain
[unittest/vqtrainph.c:248]: (error) Memory leak: vec
[unittest/vqtrainph.c:247]: (error) Memory leak: n
[unittest/vqtrainph.c:247]: (error) Resource leak: ftrain
[unittest/vqtrainsp.c:302]: (error) Memory leak: vec
[unittest/vqtrainsp.c:301]: (error) Resource leak: ftrain
[unittest/vqtrainsp.c:299]: (error) Resource leak: ferr
Index: src/quantise.c
===================================================================
--- src/quantise.c (revision 1394)
+++ src/quantise.c (working copy)
@@ -1946,7 +1946,6 @@
void decode_WoE(MODEL *model, float *e, float xq[], int n1)
{
int i;
- float err[2];
const float *codebook1 = ge_cb[0].cb;
int ndim = ge_cb[0].k;
float Wo_min = TWO_PI/P_MAX;
@@ -1955,7 +1954,6 @@
for (i=0;i<ndim;i++)
{
xq[i] = ge_coeff[i]*xq[i] + codebook1[ndim*n1+i];
- err[i] -= codebook1[ndim*n1+i];
}
//printf("dec: %f %f\n", xq[0], xq[1]);
Index: src/ampexp.c
===================================================================
--- src/ampexp.c (revision 1394)
+++ src/ampexp.c (working copy)
@@ -719,7 +719,7 @@
/* vector quantise */
- for(m=0; m<=MAX_AMP; m++) {
+ for(m=0; m<MAX_AMP; m++) {
sparse_pe_out[m] = sparse_pe_in[m];
}
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Freetel-codec2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freetel-codec2