On Tue, 22 May 2012, Diego Biurrun wrote:
On Tue, May 22, 2012 at 12:05:40AM +0200, Jordi Ortiz wrote:--- a/libavcodec/dwt.c +++ b/libavcodec/dwt.c @@ -33,10 +33,27 @@ void ff_slice_buffer_init(slice_buffer *buf, int line_count, - 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);Much better, but the loop can still be done simpler: if (!buf->data_stack[i]) { while (i >= 0) { i--; av_free(buf->data_stack[i]); } or if (!buf->data_stack[i]) { while (i >= 0) av_free(buf->data_stack[--i]);
Wouldn't these two try to free data_stack[-1]? The other ones look ok. // Martin _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
