aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mpegvideo.c
diff options
context:
space:
mode:
authorVladimir Dergachev <volodya@mindspring.com>2002-01-11 21:32:34 +0000
committerArpi <arpi@thot.banki.hu>2002-01-11 21:32:34 +0000
commit01dbbd0a9af53237cf7aac210370892208bfb957 (patch)
tree3d8fb98f811fa9a93dbd56c7e502801b4530901b /libavcodec/mpegvideo.c
parent6fb904ce304b016a6945f17cf8065637fb1cbfa9 (diff)
downloadffmpeg-01dbbd0a9af53237cf7aac210370892208bfb957.tar.gz
This fixes segfaults because of uninitialized s->mbintra_table variable - patch by Vladimir Dergachev <volodya@mindspring.com>
Originally committed as revision 256 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r--libavcodec/mpegvideo.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index e6fdc68536..e55be7b431 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -180,13 +180,13 @@ int MPV_common_init(MpegEncContext *s)
s->coded_block = av_mallocz(y_size);
if (!s->coded_block)
goto fail;
+ }
/* which mb is a intra block */
- s->mbintra_table = av_mallocz(y_size/4);
+ s->mbintra_table = av_mallocz(s->mb_width * s->mb_height);
if (!s->mbintra_table)
goto fail;
- memset(s->mbintra_table, 1, y_size/4);
- }
+ memset(s->mbintra_table, 1, s->mb_width * s->mb_height);
/* default structure is frame */
s->picture_structure = PICT_FRAME;
@@ -209,7 +209,7 @@ int MPV_common_init(MpegEncContext *s)
if (s->coded_block)
free(s->coded_block);
if (s->mbintra_table)
- free(s->mbintra_table);
+ { free(s->mbintra_table);s->mbintra_table=NULL; }
if (s->mbskip_table)
free(s->mbskip_table);
for(i=0;i<3;i++) {
@@ -234,7 +234,7 @@ void MPV_common_end(MpegEncContext *s)
free(s->dc_val[0]);
free(s->ac_val[0]);
free(s->coded_block);
- free(s->mbintra_table);
+ { free(s->mbintra_table);s->mbintra_table=NULL; }
}
if (s->mbskip_table)
free(s->mbskip_table);