avcodec/libdav1d: reset pool size on allocation failure
authorJames Almer <jamrial@gmail.com>
Sat, 16 Mar 2019 02:55:45 +0000 (23:55 -0300)
committerJames Almer <jamrial@gmail.com>
Tue, 19 Mar 2019 17:03:39 +0000 (14:03 -0300)
Signed-off-by: James Almer <jamrial@gmail.com>
libavcodec/libdav1d.c

index 8c8584f..d9079cb 100644 (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);