If an error happens when preparing the output data buffer, an already
allocated array would leak. Fix this by postponing its allocation.
Fixes Coverity issue #
1473531.
Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
int thread_num = (ctx->options.conv2d_threads <= 0 || ctx->options.conv2d_threads > av_cpu_count())
? (av_cpu_count() + 1) : (ctx->options.conv2d_threads);
int thread_stride;
- ThreadParam **thread_param = av_malloc_array(thread_num, sizeof(*thread_param));
+ ThreadParam **thread_param;
#else
ThreadParam thread_param = { 0 };
#endif
thread_common_param.ctx = ctx;
#if HAVE_PTHREAD_CANCEL
+ thread_param = av_malloc_array(thread_num, sizeof(*thread_param));
thread_stride = (height - pad_size * 2) / thread_num;
//create threads
for (int i = 0; i < thread_num; i++){