Forget this email. =(
2012/5/22 Jordi Ortiz <[email protected]>
> ---
> libavcodec/dwt.c | 19 ++++++++++++++++++-
> 1 files changed, 18 insertions(+), 1 deletions(-)
>
> diff --git a/libavcodec/dwt.c b/libavcodec/dwt.c
> index f9577fd..138abba 100644
> --- a/libavcodec/dwt.c
> +++ b/libavcodec/dwt.c
> @@ -33,10 +33,27 @@ void ff_slice_buffer_init(slice_buffer *buf, int
> line_count,
> buf->line_width = line_width;
> buf->data_count = max_allocated_lines;
> buf->line = av_mallocz(sizeof(IDWTELEM *) * line_count);
> + if (!buf->line)
> + return AVERROR(ENOMEM);
> buf->data_stack = av_malloc(sizeof(IDWTELEM *) * max_allocated_lines);
> + if (!buf->data_stack) {
> + av_free(buf->line);
> + return AVERROR(ENOMEM);
> + }
>
> - for (i = 0; i < max_allocated_lines; i++)
> + for (i = 0; i < max_allocated_lines; i++) {
> buf->data_stack[i] = av_malloc(sizeof(IDWTELEM) * line_width);
> + if (!buf->data_stack[i]) {
> + i--;
> + while (i >= 0) {
> + av_free(buf->data_stack[i]);
> + i--;
> + }
> + av_free(buf->data_stack);
> + av_free(buf->line);
> + return AVERROR(ENOMEM);
> + }
> + }
>
> buf->data_stack_top = max_allocated_lines - 1;
> }
> --
> 1.7.2.5
>
>
--
Jordi Ortiz
mailto: [email protected]
http://www.jordiortiz.es
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel