avcodec/libdav1d: reset pool size on allocation failure

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2019-03-15 23:55:45 -03:00
parent f8075b2c91
commit 5cd60b6f2e
1 changed files with 3 additions and 1 deletions

View File

@ -72,8 +72,10 @@ static int libdav1d_picture_allocator(Dav1dPicture *p, void *cookie)
av_buffer_pool_uninit(&dav1d->pool);
// Use twice the amount of required padding bytes for aligned_ptr below.
dav1d->pool = av_buffer_pool_init(ret + DAV1D_PICTURE_ALIGNMENT * 2, NULL);
if (!dav1d->pool)
if (!dav1d->pool) {
dav1d->pool_size = 0;
return AVERROR(ENOMEM);
}
dav1d->pool_size = ret;
}
buf = av_buffer_pool_get(dav1d->pool);