snow_dwt: Don't try and free members of non-existent arrays
If allocation fails earlier on, and the next frame is processed, the slice buffer could be left in a state where line and data_stack have already been freed, or are otherwise null pointers. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
This commit is contained in:
parent
0a7964dca5
commit
402a61c919
@ -91,6 +91,10 @@ void ff_slice_buffer_release(slice_buffer *buf, int line)
|
|||||||
void ff_slice_buffer_flush(slice_buffer *buf)
|
void ff_slice_buffer_flush(slice_buffer *buf)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (!buf->line)
|
||||||
|
return;
|
||||||
|
|
||||||
for (i = 0; i < buf->line_count; i++)
|
for (i = 0; i < buf->line_count; i++)
|
||||||
if (buf->line[i])
|
if (buf->line[i])
|
||||||
ff_slice_buffer_release(buf, i);
|
ff_slice_buffer_release(buf, i);
|
||||||
@ -101,6 +105,7 @@ void ff_slice_buffer_destroy(slice_buffer *buf)
|
|||||||
int i;
|
int i;
|
||||||
ff_slice_buffer_flush(buf);
|
ff_slice_buffer_flush(buf);
|
||||||
|
|
||||||
|
if (buf->data_stack)
|
||||||
for (i = buf->data_count - 1; i >= 0; i--)
|
for (i = buf->data_count - 1; i >= 0; i--)
|
||||||
av_freep(&buf->data_stack[i]);
|
av_freep(&buf->data_stack[i]);
|
||||||
av_freep(&buf->data_stack);
|
av_freep(&buf->data_stack);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user