changeset 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 47d7ce1050a6
children 909093c314e9
files libmpcodecs/vf_zrmjpeg.c libvo/jpeg_enc.c
diffstat 2 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vf_zrmjpeg.c	Mon Feb 16 09:28:56 2004 +0000
+++ b/libmpcodecs/vf_zrmjpeg.c	Mon Feb 16 14:41:42 2004 +0000
@@ -360,6 +360,9 @@
 	/* alloc bogus avctx to keep MPV_common_init from segfaulting */
 	j->s->avctx = calloc(sizeof(*j->s->avctx), 1);
 
+	/* make MPV_common_init allocate important buffers, like s->block */
+	j->s->avctx->thread_count = 1;
+
 	if (MPV_common_init(j->s) < 0) {
 		free(j->s);
 		free(j);
--- a/libvo/jpeg_enc.c	Mon Feb 16 09:28:56 2004 +0000
+++ b/libvo/jpeg_enc.c	Mon Feb 16 14:41:42 2004 +0000
@@ -352,6 +352,9 @@
 	/* alloc bogus avctx to keep MPV_common_init from segfaulting */
 	j->s->avctx = calloc(sizeof(*j->s->avctx), 1);
 
+	/* make MPV_common_init allocate important buffers, like s->block */
+	j->s->avctx->thread_count = 1;
+
 	if (MPV_common_init(j->s) < 0) {
 		av_free(j->s);
 		av_free(j);