comparison libmpcodecs/vf_zrmjpeg.c @ 11961:487d1638d161

fixing segfault: libavcodec doesn't allocate some buffers if avctx->thread_count == 0
author rik
date Mon, 16 Feb 2004 14:41:42 +0000
parents 243767239228
children 90b4a1345b96
comparison
equal deleted inserted replaced
11960:47d7ce1050a6 11961:487d1638d161
357 return NULL; 357 return NULL;
358 } 358 }
359 359
360 /* alloc bogus avctx to keep MPV_common_init from segfaulting */ 360 /* alloc bogus avctx to keep MPV_common_init from segfaulting */
361 j->s->avctx = calloc(sizeof(*j->s->avctx), 1); 361 j->s->avctx = calloc(sizeof(*j->s->avctx), 1);
362
363 /* make MPV_common_init allocate important buffers, like s->block */
364 j->s->avctx->thread_count = 1;
362 365
363 if (MPV_common_init(j->s) < 0) { 366 if (MPV_common_init(j->s) < 0) {
364 free(j->s); 367 free(j->s);
365 free(j); 368 free(j);
366 return NULL; 369 return NULL;