On Wed, Oct 09, 2013 at 10:41:13PM +0200, Anton Khirnov wrote:
> --- /dev/null
> +++ b/doc/examples/mp3_aac.c
> @@ -0,0 +1,722 @@
> +/**
> + * Initialize a temporary storage for the specified number of audio samples.
> + * The conversion requires temporary storage due to the different format.
> + * The number of audio samples to be allocated is specified in frame_size.
> + */
> +static int init_converted_samples(uint8_t ***converted_input_samples,
> +                                  AVCodecContext *output_codec_context,
> +                                  int frame_size)
> +{
> +    int error;
> +
> +    /**
> +     * Allocate as many pointers as there are audio channels.
> +     * Each pointer will later point to the audio samples of the 
> corresponding
> +     * channels (although it may be NULL for interleaved formats).
> +     */
> +    if (!(*converted_input_samples = calloc(output_codec_context->channels, 
> sizeof(**converted_input_samples)))) {
> +        fprintf(stderr, "Could not allocate converted input sample 
> pointers\n");
> +        return AVERROR(ENOMEM);
> +    }
> +
> +    /**
> +     * Allocate memory for the samples of all channels in one consecutive
> +     * block for convenience.
> +     */
> +    if ((error = av_samples_alloc(*converted_input_samples, NULL, 
> output_codec_context->channels,
> +                                  frame_size, 
> output_codec_context->sample_fmt, 0)) < 0) {
> +        fprintf(stderr, "Could not allocate converted input samples (error 
> '%s')\n", get_error_text(error));
> +        av_freep(&converted_input_samples[0]);
> +        free(converted_input_samples);
> +        return error;
> +    }
> +    return 0;
> +}

The line

        free(converted_input_samples);

generates the following warning:

CC      doc/examples/mp3_aac.o
In function ‘init_converted_samples.isra.1’,
    inlined from ‘read_decode_convert_and_store’ at 
doc/examples/mp3_aac.c:479:35,
    inlined from ‘main’ at doc/examples/mp3_aac.c:694:46:
    doc/examples/mp3_aac.c:379:13: warning: attempt to free a non-heap object 
‘converted_input_samples’ [enabled by default]

Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to