diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2024-07-11 22:55:31 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2024-07-21 17:02:13 +0200 |
commit | 82f5b20ff5be4fccbf42f4b90f155db0076c0462 (patch) | |
tree | 57093578803105ad9fe44a89ef0378bdb410a0e9 /libavutil/buffer.c | |
parent | 064bcda142dc737d8bca2d76f48c1ee9baf463b3 (diff) | |
download | ffmpeg-82f5b20ff5be4fccbf42f4b90f155db0076c0462.tar.gz |
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>
Diffstat (limited to 'libavutil/buffer.c')
-rw-r--r-- | libavutil/buffer.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libavutil/buffer.c b/libavutil/buffer.c index e4562a79b1..a8101d83f0 100644 --- a/libavutil/buffer.c +++ b/libavutil/buffer.c @@ -264,7 +264,10 @@ AVBufferPool *av_buffer_pool_init2(size_t 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; @@ -283,7 +286,10 @@ AVBufferPool *av_buffer_pool_init(size_t size, AVBufferRef* (*alloc)(size_t 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; |