mirror of https://git.ffmpeg.org/ffmpeg.git
avcodec/pthread_slice: Check for malloc failure
Found-by: CSA Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
37ec7d291e
commit
72555f4a38
|
@ -268,14 +268,17 @@ int ff_alloc_entries(AVCodecContext *avctx, int count)
|
|||
p->thread_count = avctx->thread_count;
|
||||
p->entries = av_mallocz_array(count, sizeof(int));
|
||||
|
||||
if (!p->entries) {
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
p->entries_count = count;
|
||||
p->progress_mutex = av_malloc_array(p->thread_count, sizeof(pthread_mutex_t));
|
||||
p->progress_cond = av_malloc_array(p->thread_count, sizeof(pthread_cond_t));
|
||||
|
||||
if (!p->entries || !p->progress_mutex || !p->progress_cond) {
|
||||
av_freep(&p->entries);
|
||||
av_freep(&p->progress_mutex);
|
||||
av_freep(&p->progress_cond);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
p->entries_count = count;
|
||||
|
||||
for (i = 0; i < p->thread_count; i++) {
|
||||
pthread_mutex_init(&p->progress_mutex[i], NULL);
|
||||
pthread_cond_init(&p->progress_cond[i], NULL);
|
||||
|
|
Loading…
Reference in New Issue