avutil/buffer: Check ff_mutex_init() for failure

Fixes: CID1604487 Unchecked return value
Fixes: CID1604494 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 82f5b20ff5)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2024-07-11 22:55:31 +02:00
parent 7d53bbe195
commit 15b5b0e455
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
1 changed files with 8 additions and 2 deletions

View File

@ -223,7 +223,10 @@ AVBufferPool *av_buffer_pool_init2(int size, void *opaque,
if (!pool)
return NULL;
ff_mutex_init(&pool->mutex, NULL);
if (ff_mutex_init(&pool->mutex, NULL)) {
av_free(pool);
return NULL;
}
pool->size = size;
pool->opaque = opaque;
@ -241,7 +244,10 @@ AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size))
if (!pool)
return NULL;
ff_mutex_init(&pool->mutex, NULL);
if (ff_mutex_init(&pool->mutex, NULL)) {
av_free(pool);
return NULL;
}
pool->size = size;
pool->alloc = alloc ? alloc : av_buffer_alloc;