Pander <pan...@users.sourceforge.net> wrote:
> Please review the attached patch for outputting the average power spectrum.

I am not knowledgable in the math behind this, but I noticed one
memory management error:

> @@ -134,6 +138,15 @@ static int sox_stat_flow(sox_effect_t * effp, const 
> sox_sample_t *ibuf, sox_samp
>    priv_t * stat = (priv_t *) effp->priv;
>    int done, x, len = min(*isamp, *osamp);
>    short count = 0;
> +  float *re_average;

re_average needs to be initialized for the "stat->fft_average != 1" case

  float *re_average = NULL;

> +  if (stat->fft_average == 1) {
> +      samples = (stat->fft_size / 2);
> +      ffa = effp->in_signal.rate / samples;
> +      re_average = lsx_malloc(sizeof(float) * (int)samples);
> +  }

...otherwise, free may be called on an uninitialized value:

> +  if (re_average) {
> +    free(re_average);
> +  }
>    *isamp = *osamp = len;
>    /* Process all samples */

There's also a bunch of unrelated whitespace eliminations
in the manpage which should probably be a separate commit
(but I'm not a sox maintainer, just another user + occasional patcher).

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
SoX-devel mailing list
SoX-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-devel

Reply via email to